Profiling a WCF Service

I am trying to profile a WCF service but the tool does not allow the server piece built into vs.net to run the service.
What is the secret?

0
10 comments

Hi,

I am not sure I completely understand your usecase.
You have WCF service hosted in VS development server, right?
Or your WCF service is hosted in Windows service?
Have you seen this howtos?
http://confluence.jetbrains.net/display/NetProf/How+to+profile+a+webservice+with+dotTrace+4.0
http://confluence.jetbrains.net/display/NetProf/How+to+profile+Windows+Service+with+dotTrace+4.0

Please clarify at what step do you get a problem.

Regards,
Ivan Shakhov

0
Avatar
Permanently deleted user

I am evaluating dotTrace as well and am unable to figure out how to profile a WCF service that resides within a WCF service host that is launched from Visual Studio during the debug process. Any insight how to do this is greatly appreciated. Thanks.

0

Hi,

I assume that you use VS 2010 and you have dotTrace integration with VS installed, right?
Then you just run dotTrace-.Profile Startup project from the menu. Leave defaults in the profiler configuration and press Run. VS development server will start and gets profiled by dotTrace, browser will start with a page like http://127.0.0.1:51882/
Then we need to exercise our service somehow. How do you usually run or debug it?
For example you can use WcfTestClient.exe
http://msdn.microsoft.com/en-us/library/bb552364.aspx
Other option is to create a unit test project, add a webreference to your webservice, create a new test and run (do not try to profile) test.

Hope this helps.
Ivan Shakhov

0
Avatar
Permanently deleted user

Hi Ivan. Thank you for your reply. I should have explained in my original post my development environment which is actually VS 2008 Professional with DotTrace integration (trial version). The solution that I am loading into VS has two projects, one project is a class library with classes marked with the ServiceBehavior attribute (we do not use SVC files) and the other project is the startup project which is just a console application that invokes the WCF Service. We then have another solution that contains a WebForms projects that consumes the service.

Since my startup project is just a console application, how do I configure DotTrace to profile the actual WCF service? What I have been trying is selecting the different Application Types in the Profile Application menu of DotTrace but there doesn't appear to be a type specific to WCF and the built-in WCF service host with VS.

0

Mark,

Thank you for the clarification.
The easiest way is to use dotTrace Profile .Net Process mode.

1. Select dotTrace->Profile Application->.Net Process - You will see empty "Profiler controller" window
2. Run your service. It will start inside WcfSvcHost.exe
3. Run your unit test or console application or WCFTestClient, which uses WCF service.
4. You will get two or more snapshots from dotTrace - one for client program and one for webservices.
5. Your wcf service code will be inside the snapshot from WcfSvcHost.exe
service.png

Regards,
Ivan Shakhov

There were a mistake in this post, thus this post was corrected for future reference.

0
Avatar
Permanently deleted user

I am successful in completing these steps but the WcfSvcHost.exe process that populates into the dropdown list of the Profiler Controller menu refer to the assembly configuration files. As a result when I grab the snapshot, it only profiles obtaining the configuration file and not the service itself.

Overall, I would like to be able to specify the metadata address of the service (just like WcfTestClient) in dotTrace rather than selected from a process list. Is this possible?

Also, I am not sure I understand the recommendation of using a web service as a startup project. Are you saying I should create a web service project and write webmethods that call the service?

0

Mark,

Yeh, sorry, pointing w3wp.exe was my mistake. I have updated the previous post, to avoid misleading other people.

1. Are you sure that you look in the correct snapshot? Your service code must be in the snapshot generated from WcfSvcHost.exe.
2. If you are looking in the correct snapshot then try to search some your class/method name (press Ctrl+F)? Or open PlainView and group by namespaces. Your code must be there.

Regarding to your question: In principle it is possible to run WcfSvcHost.exe as a command line under profiler. It resides in "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE". Run it and it will show its commandline switches. But using it that way is not easy at all. Thus my recommendation - dotTrace .Net Process mode is much easier. The resulting snapshot will be the same.

Ivan

0
Avatar
Permanently deleted user

Thank you for updating your post and including a screenshot. The w3wp.exe threw me off but based on your revised steps, I am successful in profiling my services using WCF Test Client and dotTrace shows all the various methods and namespaces specific to our service. However, when I use our webforms project that consumes the services, nothing shows up except calls to the config file.

The service I am interested in profiling returns stream data types and WCF Test Client doesn't support this so it's important for me to get profiling working correctly when using the webform. Attached is a screenshot of what the Plain View window contains when consuming the service using the webform. I'm not sure if the limited information in the snapshot is due to the webform or dotTrace itself.



Attachment(s):
dotTrace PlainView.gif
0

Mark,

Is it possible that you send me your project privatelly? Or just some simple project at which the same issue is reproduced?
You can reach me by email support@jetbrains.com.
By the way, if your evaluation time is over I can provide some extension.

Regarding directly to you question. Have you checked that WCFServiceHost was not running already when you started to profile in the .Net Process mode?
It is visible in tray (first from the left) and also in TaskManager.
wcf.jpg
If it was running, then it will not be profiled in the .Net Process mode

Ivan

0

Hi all,

We have improved profiling for WCF service library application type in dotTrace 4.5.
Here are the steps:
1. Make your WcfServiceLibrary a default project in VS
2. dotTrace -> "Profile startup project". It will start a WcfServiceHost for you.
3. Run your client application or unit tests to make your service do some useful work.
4. Get Snapshot...

WRB, Ivan Shakhov

0

Please sign in to leave a comment.