SIGN UP MEMBER LOGIN:    
ARTICLE

Debugging a WCF Service from Silverlight

Posted by Dhananjay Kumar Articles | Silverlight with C# October 18, 2011
Debugging a WCF Service from Silverlight: The Breakpoint will not currently be hit at the WCF Service.
Reader Level:

Assumption

  1. Binding configuration at WCF has debugging enabled
  2. Cross domain problem has been take care of since WCF and Service is running on different servers.
  3. Visual studio is running in administrator credentials or credentials having enough permission to debug on server.

While working today I came across a requirement to debug a WCF Service from Silverlight and it took me one hour to find the solution, I had the above three assumptions met and I was not able to debug WCF Service from Silverlight.

I had the architecture of solution as below,

WCFSil1.gif

There is nothing unusual in the above architecture. I had Silverlight, Web Application and WCF as part of the same solution. The problems came when I tried to debug the WCF service from Silverlight. I was getting the below information at the breakpoint in the service side and I was never able to hit the service while debugging.

WCFSil2.gif

I binged a lot but did not get quiet good solution suggesting solving this. Eventually I found it very simple way to solve this.

Follow steps as below to hit the breakpoint in the service ,

Set the web application as the Startup project

WCFSil3.gif

Put a breakpoint on Xaml.cs and run the Silverlight application and upon hitting the  breakpoint on the XAML page stop for a while

WCFSil4.gif

While the breakpoint on XAML is hit, select Tools from the menu and choose Attach to Process.

WCFSil5.gif

And then attach to the WCF host server.

WCFSil6.gif

Once after attaching to the WCF host server you should able to hit the breakpoint in the  WCF Service from Silverlight.

I hope this post was useful. Thanks for reading.

If you find my posts useful you may like to follow me on twitter http://twitter.com/debug_mode or may like Facebook page of my blog http://www.facebook.com/DebugMode.Net If you want to see post on a particular topic please do write on FB page or tweet me about that, I would love to help you.

 

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Become a Sponsor