Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting a 404 error on /mini-profiler-resources/includes.js when deployed to server

I am using MiniProfiler for an asp.net web api site that has an mvc aspect for its help pages.

I am attempting to profile one of the api methods, which is successful on my local machine, but when I deploy to my test server (win2008r2 / IIS 7.5), I am able to browse to /mini-profiler-resources/results, but the page is blank because I am getting a 404 on includes.js

I've been reviewing the answers here which talk about adding entries to <system.webServer><handlers>, and/or adding <system.webServer><modules runAllManagedModulesForAllRequests="true"/>, none of which are successful in my case.

Here's the relevant code in my global.asax. I'm not sure if MiniProfilerHandler.RegisterRoutes() is necessary:

protected void Application_Start()
{
  AreaRegistration.RegisterAllAreas();

  AutofacConfig.Register(GlobalConfiguration.Configuration);
  WebApiConfig.Register(GlobalConfiguration.Configuration);
  FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
  RouteConfig.RegisterRoutes(RouteTable.Routes);
  BundleConfig.RegisterBundles(BundleTable.Bundles);

  FluentValidationConfig.RegisterForWebApi(GlobalConfiguration.Configuration);

  MiniProfilerHandler.RegisterRoutes();
  MiniProfilerEF6.Initialize();
  Database.SetInitializer<OasisIntegrationEntities>(null);

  // UseMiniProfilerUi(object) returns true.
  MiniProfiler.Settings.Results_Authorize = UseMiniProfilerUi; 
  MiniProfiler.Settings.Results_List_Authorize = UseMiniProfilerUi;
}

Is miniprofiler just not meant to run on the server, or am I missing something?

like image 618
meataxe Avatar asked Feb 12 '23 00:02

meataxe


1 Answers

Adding the following to web.config ("handlers" section) did the trick for me:

<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*" type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />

Also, try to install https://www.nuget.org/packages/MiniProfiler.Mvc4/.

like image 53
Oren Kleinmann Avatar answered Feb 14 '23 00:02

Oren Kleinmann