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

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.

1 Like

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

@Sam which KB article are you talking about?

1 Like

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…

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

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

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

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?

Never mind, I was doing something stupid :slight_smile:

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);