404 when miniprofiler posts to mini-profiler-resources/results


#1

We have a ASP.NET MVC app. We are using the latest version and have tried all the web.config changes suggested around the place for other 404 issues.

One difference here is that it only seems to apply to the text/html POSTs. All GETs and application/json POSTs work.


#2

I am having the same issue. Below is what the Chrome console tells me.

@Sam which KB article are you talking about?


#3

When using MiniProfiler in an application hosted on multiple instances, MiniProfiler receives a 404 when POST is done to /mini-profiler-resources/results.

The reason is because the default implementation of the IStorage provider uses HttpRuntime.Cache. This cache is machine specific, and as a result instance B cannot access the MiniProfiler data saved on instance A.

See the MiniProfiler.AzureCacheStorage repo on GitHub for the solution.


I thought about submitting this as a pull request to the project, but MiniProfiler would then have to take a dependency on the Azure caching assemblies. I don’t think this is wise, and would bloat Mini Profiler a little bit.

In a perfect world, MiniProfiler would have an ICacheProvider (defaulted to the HttpRuntim.Cache) that we would be able to specify. There could be providers the Azure cache, Memcached, redis, etc…

Perhaps that would make a good pull request…


#4

Can you post a link to a sample that reproduces the issue? Is the kb article relevant?


#6

@daveh, Would you by chance be hosting this in Azure?


#7

Error solved. See the workaround. Maybe this should be added to the KB


#8

I’m having the same problem. My application is running in IIS express and I have tried the solutions on SO. What else could I try?


#9

Never mind, I was doing something stupid :slight_smile:


#10

Realise my issue was probably due to something else, but hopefully this will help someone else.

I managed to get a 404 - turned out it was because I was discarding the results at the end of the request…
MiniProfiler.Stop(discardResults: true);

…changed to…
MiniProfiler.Stop(discardResults: false);