Visual Studio 2008 Performance Profiler Problems with ASP.NET

泄露秘密 提交于 2020-01-03 15:58:08

问题


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?


回答1:


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




回答2:


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.




回答3:


Here is how I got it worked for my ASP.NET site under VS2010

  1. Make sure your web.config is writable

  2. 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

  1. Right click on your performance session and choose 'Attach', and choose your web server process

Now go to your site and do whatever scenarios, then back to your VS and click stop.




回答4:


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




回答5:


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

<appSettings configSource="App_Config\AppSettings.config" />

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.



来源:https://stackoverflow.com/questions/1684688/visual-studio-2008-performance-profiler-problems-with-asp-net

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!