mvc mini profiler - Can't get MVC MiniProfiler to show on ASP.net website -
my web.config file:
<?xml version="1.0" encoding="utf-8"?> <configuration> <configsections> <section name="rewriter" requirepermission="false" type="intelligencia.urlrewriter.configuration.rewriterconfigurationsectionhandler, intelligencia.urlrewriter" /> </configsections> <system.web> <customerrors mode="on" redirectmode="responserewrite"> <error statuscode="500" redirect="~/content/errorpages/500.aspx" /> <error statuscode="404" redirect="~/content/errorpages/404.aspx" /> </customerrors> <compilation debug="true" targetframework="4.5.1" /> <httpruntime targetframework="4.5.1" /> <httpmodules> <add type="intelligencia.urlrewriter.rewriterhttpmodule, intelligencia.urlrewriter" name="urlrewriter" /> </httpmodules> </system.web> <rewriter configsource="config\urlrewrites.config" /> <appsettings configsource="config\settings.config" /> <system.webserver> <validation validateintegratedmodeconfiguration="false" /> <httperrors errormode="custom"> <remove statuscode="500" substatuscode="-1" /> <remove statuscode="404" substatuscode="-1" /> <error statuscode="404" path="/content/errorpages/404.aspx" responsemode="executeurl" /> <error statuscode="500" path="/content/errorpages/500.aspx" responsemode="executeurl" /> </httperrors> <modules runallmanagedmodulesforallrequests="true"> <remove name="urlrewriter" /> <add name="urlrewriter" type="intelligencia.urlrewriter.rewriterhttpmodule,intelligencia.urlrewriter" precondition="managedhandler" /> </modules> <handlers> <add name="miniprofiler" path="mini-profiler-resources/*" verb="*" type="system.web.routing.urlroutingmodule" resourcetype="unspecified" precondition="integratedmode" /> </handlers> </system.webserver> </configuration>
my global.asax:
using system; using system.web; using stackexchange.profiling; namespace c3 { public class global : httpapplication { protected void application_beginrequest(object sender, eventargs e) { // force https if (!httpcontext.current.request.issecureconnection) { response.redirect(settings.securerootdomain + httpcontext.current.request.rawurl); } if (request.islocal) { miniprofiler.start(); } } protected void application_endrequest() { miniprofiler.stop(); } } }
content page:
<%@ page language="c#" autoeventwireup="true" codebehind="default.aspx.cs" inherits="c3.default"%> <%@ import namespace="c3.code" %> <%@ import namespace="stackexchange.profiling" %> <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <% seo.checkurl("/"); %> <title></title> <%=miniprofiler.renderincludes() %> </head> <body> <form id="form1" runat="server"> <div> dum de dum </div> </form> </body> </html>
and code behind:
protected void page_load(object sender, eventargs e) { var profiler = miniprofiler.current; // it's ok if null using (profiler.step("set page title")) { page.title = "home page"; } using (profiler.step("doing complex stuff")) { using (profiler.step("step a")) { // more interesting here thread.sleep(100); } using (profiler.step("step b")) { // , here thread.sleep(250); } } }
any ideas why miniprofiler isn't showing anything?
update
if visit https://127.0.0.1:3333/mini-profiler-resources/includes.js
in browser, it's returning js file! it's not rendering includes on page itself.
if visit /mini-profiler-resources/results
throws error:
object reference not set instance of object.
description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code.
exception details: system.nullreferenceexception: object reference not set instance of object.
source error:
an unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below.
stack trace:
[nullreferenceexception: object reference not set instance of object.]
stackexchange.profiling.miniprofilerhandler.getsingleprofilerresult(httpcontext context) in c:\teamcity\buildagent\work\1de24adb938b932d\stackexchange.profiling\miniprofilerhandler.cs:292 stackexchange.profiling.miniprofilerhandler.processrequest(httpcontext context) in c:\teamcity\buildagent\work\1de24adb938b932d\stackexchange.profiling\miniprofilerhandler.cs:93 system.web.callhandlerexecutionstep.system.web.httpapplication.iexecutionstep.execute() +912 system.web.httpapplication.executestep(iexecutionstep step, boolean& completedsynchronously) +164
ensure pages showing miniprofiler don't contain ignored path in url specified miniprofiler.settings.ignoredpaths
, default has /content/
, /scripts/
, /favicon.ico
. page url /content/default.aspx
won't show miniprofiler, whereas /pages/default.aspx
show it.
alternatively, remove /content/
miniprofiler.settings.ignoredpaths
.
Comments
Post a Comment