Options

How do you profile a WCF service in IIS 7?

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?

Comments

  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
  • Options
    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.
  • Options
    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.
  • Options
    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?
  • Options
    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".
  • Options
    I have and still nothing.
  • Options
    Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    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.
Sign In or Register to comment.