I've been trying, and failing, to get VS.NET 2008 to profile an ASP.NET MVC application. When I try and start a profiling session I get a generic server 500 error from VS.NET:
The web site could not be configured correctly; getting ASP.NET process information failed. Requesting 'http://localhost:4750/foo/VSEnterpriseHelper.axd' returned an error: The remote server returned an error: (500) Internal Server Error.
I've tried several things, including:
- ensuring that web.config is writable
- ensuring that there aren't any permissions issues (everything is running as me, I'm an admin, and UAC is off)
- everything mentioned here: 500 Error Running Visual Studio ASP.NET Unit Test
A brand new ASP.NET MVC app (i.e. File | New | Project ) will profile without problem, so I know my machine is capable of profiling such an app.
So, my question here is what are the other common and uncommon things that can prevent VS.NET from starting a profiling session on an ASP.NET app?
If you can't get VS.Net profiling to work there are a couple of 3rd party tools that might help. Obviously youy'll need to pay for these though.
ANTS has a free demo here: http://www.red-gate.com/products/ants_memory_profiler/index_v2.htm
JetBrains also have a trace tool that offers profiling (I have not used this but I like their Resharper tool, so I suspect this will be good): http://www.jetbrains.com/profiler/index.html
If you have a split configuration setup with external AppSettings, this is likely to cause an error like this.
The Visual Studio profiler seems to have a problem identifying that you include your AppConfig settings via
and that it needs to insert any AppSettings necessary for profiling there instead of the web.config directly.
In my case, moving the AppSettings back into the web.config fixed the issue.
Here is how I got it worked for my ASP.NET site under VS2010
Make sure your web.config is writable
Create a new performance session and don't add any project to it
Instead add the URL of your website "Target -> right click -> add existing web site" Make sure to run the web site once so that the IIS process or ASP.NET server process is up and running
Now go to your site and do whatever scenarios, then back to your VS and click stop.
In between wrestling with profilers, you can easily get a pretty good picture of what your program is doing from a time perspective by this method. What it reveals is usually a surprise.
Added: I do a fair amount of tuning, and I have a different perspective on these things, such as: wall-clock time is all that matters, individual instructions are more important than functions/methods, call trees & graphs are interesting but nobody knows what they really mean in terms of performance, the demos are all stilted toys like Mandelbrot, and individual samples are where the money's at, not summaries.
For example, tuning a .NET app, it takes a long time starting up. So in that interval, I sample it several times and ask "What is it doing and why?" It is looking up strings by ID in resources (so the strings can be internationalized). Is it necessary? If I look at the particular strings, they are ones that never need to be internationalized. No profiler can tell me this, but samples find it immediately.
Not sure if you've seen this: http://social.msdn.microsoft.com/Forums/en-US/tfsbuild/thread/8366799f-7bfd-4c80-a5f1-11a57ecfd966/
but it appears to be reporting the same issue you have and there is a response from the MSFT developer who wrote the Profiler tool:)