Skip to main content
Home Forums Silverlight Programming Accessing Web Services with Silverlight Accessing WCF Service from Class Library or From a Referenced Assembly
4 replies. Latest Post by Jean-Pierre Fouche on November 6, 2009.
(0)
Jean-Pie...
Member
27 points
31 Posts
11-06-2009 11:01 AM |
Hello, I can access a WCF service from the following applications: 1. From a .NET Unit Test Class. 2. From a Silverlight Application I cannot access the same WCF Service in a Silverlight Application, when the WCF client is in a referenced class library. The code stops running as soon as it goes into the constructor. I can see no errors - the browser show a white screen. Questions: ========== 1. Why would this be the case? 2. How would I go about debugging, as it seems not to throw an error? (I have checked the Application_UnhandledException in App.xaml, and the debugger doesn't go there).
prujohn
Contributor
3569 points
704 Posts
11-06-2009 11:07 AM |
With WCF services, the first thing I usually do is load up Fiddler and inspect the Http traffic. First profile your app with the WCF service calls that are working, so that you see what the traffic should look like (baseline), then run it with the WCF service from your library and note the difference. That may help point you in the right direction.
bryant
Star
9937 points
1,629 Posts
If you put a try/catch around the service call can you get the exception? Also, have you tried putting a breakpoint to see if the call is executing?
11-06-2009 11:14 AM |
Answering my own question: 1. If referencing an assembly, the ServiceReferences.clientconfig must be in the HOST application i.e. in the Silverlight Application, and no in the referenced assembly. 2. To get the error message, if put a try...catch around the service instantiation. This gave me the error, and from there I was easily able to fix the problem!
11-06-2009 11:16 AM |
Thanks Byant! We seem to have arrived at the same answer :)