Skip to main content

Microsoft Silverlight

Answered Question Accessing WCF Service from Class Library or From a Referenced AssemblyRSS Feed

(0)

Jean-Pierre Fouche
Jean-Pie...

Member

Member

27 points

31 Posts

Accessing WCF Service from Class Library or From a Referenced Assembly

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
prujohn

Contributor

Contributor

3579 points

704 Posts

Re: Accessing WCF Service from Class Library or From a Referenced Assembly

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
bryant

Star

Star

9937 points

1,629 Posts

Silverlight MVP
Answered Question

Re: Accessing WCF Service from Class Library or From a Referenced Assembly

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?

-- bryant

Blog | Twitter
_________________
Dont forget to click "Mark as Answer" on the post that helped you.

Jean-Pierre Fouche
Jean-Pie...

Member

Member

27 points

31 Posts

Answered Question

Re: Accessing WCF Service from Class Library or From a Referenced Assembly

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!

Jean-Pierre Fouche
Jean-Pie...

Member

Member

27 points

31 Posts

Re: Accessing WCF Service from Class Library or From a Referenced Assembly

Thanks Byant! We seem to have arrived at the same answer :)

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities