How do you profile a WCF service in IIS 7?

Code profiling for .NET Developers

Moderators: Luke Jefferson, StephenC, Alex.Davies, AndrewH, melvyn.harbour, Laura Morley

How do you profile a WCF service in IIS 7?

Postby RazorKramer » Wed Feb 23, 2011 8:46 am

When I attempt to profile a WCF service in IIS 7, I only get system level methods in the trace window. Why don't I see my custom code getting called?
RazorKramer
 
Posts: 4
Joined: Wed Feb 23, 2011 8:12 am

Postby Brian Donahue » Wed Feb 23, 2011 2:33 pm

Are you actually invoking the WCF service using whatever client you normally use? Profiler can't profile code that hasn't been run.

Additionally the profiling settings are really confusing. Basically you have to remember to reconfigure your client contract to use the TCP port you specified in ANTS Profiler's unused port setting or your client will be hitting the other copy of the website that is still hosted in IIS rather than the one hosted by Profiler.

Gets you every time.
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am

Postby RazorKramer » Wed Feb 23, 2011 3:49 pm

Yeah, I believe I'm doing everything right. I have even shutdown the IIS application pool, tried to call it and as expected I got a "service point is not listening" type of error. Then I fired up ANTS using the original port and I was able to call the service. So I think I have all that correct?

Now when I call the service method in my WCF service which calls another class method that performs a Thread.Sleep for 4 seconds, I only see the System type of methods listed in the Method window. I would expect at this point to see my service class method and the other class method that contains the sleeper method to be listed, would that be an accurate assumption?

Another thing to note is when I call the service for the first time since starting ANTS, I do see a spike in the ANTS Processor Time graph which lists System methods and one thing of particular interest is a note entry within the Method window stating "Transition to managed code...". What the heck does that mean? Is that where I should see my managed code? I do have Profile Child Processes checked.

The other thing I'm a bit fuzzy on... if I was to have a web service at the following location http://localhost/MyWcfService/MyTestService.svc, do I provide http://localhost/MyWcfService/MyTestService.svc or http://localhost/MyWcfService in the application URL un the Application Settings?

I'm evaluating the product and not having the ability to affectively profile a web service is a deal breaker.
RazorKramer
 
Posts: 4
Joined: Wed Feb 23, 2011 8:12 am

Postby Brian Donahue » Wed Feb 23, 2011 4:27 pm

Can you try shutting down IIS and then see if your WCF consumer still functions properly? If not, your calls are going to the WCF svc hosted in IIS. This would explain why it appears to work and you see none of your methods in the results.
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am

Postby RazorKramer » Wed Feb 23, 2011 6:00 pm

I shutdown IIS and tested w/out ANTS and I get a service endpoint is not listening type of error. I start ANTS and I can call the service successfully.

ANTS is on CPU Time and all I have is System type of methods in the Method window. What does draw my attention is that there is an entry labeled "Transition to managed code..." which feels like that is where the details are that I'm looking for. The problem is that message is very static and I can't expand it or nothing.

Any ideas?
RazorKramer
 
Posts: 4
Joined: Wed Feb 23, 2011 8:12 am

Postby Brian Donahue » Wed Feb 23, 2011 6:08 pm

Hi,

There are a few things in the tree view that have no detail like "thread blocked" and "transition to managed code". This is not related to the problem.

Can you try turning all filters off? Ie: "hide insignificant methods" off, show "all threads" and "all methods" rather than "methods with source code".
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am

Postby RazorKramer » Wed Feb 23, 2011 6:54 pm

I have and still nothing.
RazorKramer
 
Posts: 4
Joined: Wed Feb 23, 2011 8:12 am

Postby Brian Donahue » Thu Feb 24, 2011 10:52 am

Does the status of Profiler (lower-left) say "profiling..." the whole time? Maybe your web app is crashing. It's the most common problem with Profiler at the moment.
Brian Donahue
 
Posts: 6668
Joined: Mon Aug 23, 2004 10:48 am


Return to ANTS Performance Profiler 6

Who is online

Users browsing this forum: No registered users and 0 guests