I'm using Mvc-Mini-Profiler (what a great product!). Using my ordinary web browser everything seems to work fine but as soon as I use my own http client (basic http 1.1 without cookie support) the amount of X-MiniProfiler-Ids in the http header increases. This happens quite rapidly and becomes quite many in a short amount of time (11kB and above of data).
Can the lack of cookies make Mvc-Mini-Profiler work this way or could anything be wrong with my implementation?
Abstract: Profiling MVC production code at runtime can often be tough, messy and a performance hog. MiniProfiler created by the Stack Exchange team is an easy-to-setup-and-use profiling library for ASP.NET MVC and Entity Framework.
Run the application now and you’ll see the profiler indicator come up. As you can see, there are two little divs on the top. Miniprofiler automatically detected the AJAX call and added separate profiling information for the AJAX call. Expanding it shows us the Ajax query and the time it took to do the query.
The default is mini-profiler-resources, so the results would be available at /mini-profiler-resources/results. With this setting, the result is available at /profiler/results. Time to define our traces! When you fire up the application, a MiniProfiler object is created and shared across the project.
First, create an application in ASEP.NET MVC 4, right-click on the project, and choose “Manage NuGet Packages..” to install MiniProfiler for ASP.NET MVC application. As we can see with the below screenshot, we have searched for MiniProfiler.MVC and are going to install the second one, “MiniProfiler.Mvc4”.
This is by design I think. Though we could improve the implementation a bit.
The X-MiniProfiler-Ids
need to be "consumed", they only show up when profiling is enabled. The reason it works this way is so you can profile POST
and redirects.
We probably should set some clear upper limit there (like 20 or so) - please post a bug for that.
However, since you never really plan to consume any profiling blocks for you HTTP client, I would recommend abandoning profiling if the useragent is your HTTP client.
You can do this by adding a conditional before:
// don't run if UserAgent is "my http client"
if(notMyUserAgent)
MvcMiniProfiler.MiniProfiler.Start();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With