Profiler not set up right?

Code profiling for .NET Developers

Profiler not set up right?

Postby ericness » Sat Feb 26, 2011 12:09 am

So I am trying to run the profiler with a mvc application locally. As soon as I run the profiler it just shows me Directory Listing and is on a different port than when I run the application. Even if I change the port number to listen in on the same one where I am testing - the profiler gives me an error saying that the port is in use.

Could not launch the task to be profiled.
Posts: 1
Joined: Fri Feb 25, 2011 11:59 pm

Postby Brian Donahue » Sat Feb 26, 2011 11:12 am


The dialog for profiling a website very often leads you down the wrong path. If I can explain what the settings do, this should help.

At the root of the problem, Profiler NEEDS an unused TCP port because it runs an ASP .NET worker process outside of IIS. It launches w3wp from the console and the only bindings it can use this way are TCP port (host headers, etc don't matter).

Since it is launching a listener on this port, it can't be in use - ie IIS cannot also be listening on that port at the same time. To make things worse, the "profile on original port" setting seems to have no effect except to restart IIS, which will fail about 50% of the time. Do not use this. Also, specifying the ASPNET user account is only meant for a specific circumstance on WinXP. Don't use that either.

The address textbox lets you include a port, but this is only for the purpose of allowing Profiler to parse the bindings in IIS to find the website's virtual directory location. The website you are profiling will actually answer on the unused port, by default 8013.

So what you are meant to do is specify the address the site normally runs on in the address textbox, ie http://localhost:80/MyApp and the port Profiler will run it on in the unused port textbox (8013). If you want to invoke the code so Profiler will pick it up, you must tell your browser to open http://localhost:8013/MyApp. Your browser can still open http://localhost:80/MyApp, but that request will be serviced by IIS and not profiled.

If your website must run on the original port, tell profiler unused port (80) and shutdown the website in IIS.

Finally, I don't think the worker process started by Profiler respects the default document you've set and that's how you end up with a directory listing. You just need to click on your default document.

Sorry this dialogue is so misleading. I would personally like very much to have it changed.
Brian Donahue
Posts: 6590
Joined: Mon Aug 23, 2004 9:48 am

Postby Brian Donahue » Fri Mar 18, 2011 3:22 pm

Just as a follow-up, I've spent the afternoon reviewing the IIS code because it's caused all of our customers such a hassle.

A lot of the issues I've highlighted were based on my understanding of the version 5 code and there have been some significant changes in v6 as far as I can tell.

1. Profile on original port actually does something besides start IIS for no reason - it changes the profiling so any process started by the W3SVC will have profiling hooked in. The IISRESET seems to fail a lot of the time, but this must be for reasons other than the code (ie access rights, etc).

2. ASP .NET Account details - the original purpose of this was in the case where we could not read the information from Machine.config in IIS v5. In Profiler v6, this also has the effect of starting the worker process (w3wp.exe) as the named user. The username and password are used to create a login token to use when launching w3wp.exe.

3. The ANTS Profiler 6 Service is used as a fallback when launching the w3wp.exe process fails.

The complication of this setup makes it extremely difficult for us in support to diagnose any IIS issue. We appreciate your patience if you do run into any IIS issues.
Brian Donahue
Posts: 6590
Joined: Mon Aug 23, 2004 9:48 am

Return to ANTS Performance Profiler Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests