无法显示 mvcMiniProfiler

发布于 2024-12-11 03:08:13 字数 2281 浏览 3 评论 0原文

我试图快速构建一个网站,因此我寻求了 Twitter 的 Bootstrap 项目 的帮助,这对于像我这样的非设计师来说是一个救星。

我现在正在尝试启动并运行 MiniProfiler(它看起来棒极了!),但是在显示它时遇到了一些麻烦,我希望有人可以帮助我发现我的(可能很简单)错误。这是最基本的基本场景,据我所知,我正在遵循 MiniProfiler 站点的建议。

global.asax:

using MvcMiniProfiler;
    ...
    protected void Application_BeginRequest()
{
//profile for every request while site is in dummy mode
        MiniProfiler.Start();
}

protected void Application_EndRequest()
{
    MiniProfiler.Stop();
}

我尝试分析的控制器:

public ActionResult About()
{
    var profiler = MiniProfiler.Current;
    using (profiler.Step("Wassappp?"))
    {
        ViewBag.Title = "Heyyy there! Testing MiniProfiler.";
        using (profiler.Step("Doing a pointless for loop!"))
        {
            int result;
            for (int i = 0; i <= 10; i++)
            {
                result = i;
            }
        }
    }
    return View();
}

我的 _layout.cshtml 页面的相关部分:

@using MvcMiniProfiler;
...
  <head>
    <meta charset="utf-8">
    <title>@ViewBag.Title</title>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
        <!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

    <link rel="shortcut icon" href="images/favicon.ico">
    <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">

    <link href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css" rel="stylesheet">
    <link href="@Url.Content("~/Content/site_bootstrap.css")" rel="stylesheet">


    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    @MvcMiniProfiler.MiniProfiler.RenderIncludes()

  </head>

有什么想法吗?该站点显示得很好,但没有任何类型的 MiniProfiler 操作。

预先感谢您提供的任何帮助!

I'm trying to throw together a site pretty quickly, and so I enlisted the help of Twitter's Bootstrap project, which has been a lifesaver for a non-designer like me.

I'm now attempting to get the MiniProfiler up and running (it looks awesome!) but am having some trouble getting it to display and I hope someone can help me catch my (likely simple) mistake. This is the most basic of basic scenarios, and as far as I can tell I'm following the recommendations of the MiniProfiler site.

global.asax:

using MvcMiniProfiler;
    ...
    protected void Application_BeginRequest()
{
//profile for every request while site is in dummy mode
        MiniProfiler.Start();
}

protected void Application_EndRequest()
{
    MiniProfiler.Stop();
}

The Controller I'm attempting to profile:

public ActionResult About()
{
    var profiler = MiniProfiler.Current;
    using (profiler.Step("Wassappp?"))
    {
        ViewBag.Title = "Heyyy there! Testing MiniProfiler.";
        using (profiler.Step("Doing a pointless for loop!"))
        {
            int result;
            for (int i = 0; i <= 10; i++)
            {
                result = i;
            }
        }
    }
    return View();
}

The relevant section of my _layout.cshtml page:

@using MvcMiniProfiler;
...
  <head>
    <meta charset="utf-8">
    <title>@ViewBag.Title</title>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
        <!--[if lt IE 9]>
            <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->

    <link rel="shortcut icon" href="images/favicon.ico">
    <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
    <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png">

    <link href="http://twitter.github.com/bootstrap/1.3.0/bootstrap.min.css" rel="stylesheet">
    <link href="@Url.Content("~/Content/site_bootstrap.css")" rel="stylesheet">


    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
    @MvcMiniProfiler.MiniProfiler.RenderIncludes()

  </head>

Any ideas? The site displays exactly fine, but without any sort of MiniProfiler action.

Thanks in advance for any help you can give!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

氛圍 2024-12-18 03:08:13

我刚刚下载了我制作的 Twitter Bootstrap 包 http://nuget.org/List/Packages/ MahApps.Twitter.Bootstrap 然后是 MiniProfiler.MVC 包 http://nuget.org/List/Packages/MiniProfiler.MVC3 ,然后确保 RenderIncludes 行位于 CSS 定义下方并且工作正常。

我会尝试一个快捷方式并确保您使用的是 Miniprofiler 的 MVC 包。

I just downloaded the Twitter Bootstrap package I made http://nuget.org/List/Packages/MahApps.Twitter.Bootstrap and then the MiniProfiler.MVC package http://nuget.org/List/Packages/MiniProfiler.MVC3 and then made sure the RenderIncludes line was below the CSS definitions and it worked fine.

I'd try a shortcut and make sure you're using the MVC package of Miniprofiler.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文