Search code examples
wcfcommunicationexception

Internal fault in MS auto-generated method of WCF


I have a problem with WCF. My testing code is pretty simple.

I call a service layer method on my server from my silverlight application and print the result in a textbox.

Everything of this is surrounded by try-catch.

When my service layer method simply returns a constantly defined string there seems to be no problems - however as soon as it calls a more complex method it fails.

While debugging it does not even reach the complex model method; it fails before that inside some auto-generated code from microsoft:

/WuSIQ.jpg

As the error message "NotFound" is not exactly the most helpful or specific you can imagine my trouble googling for hints.

I thought maybe the auto-generated code could only send simple data so I made a temporary string and returned that, but this did not help.

I have already: a client access policy, a service reference added, removed duplicate reference in ServiceReferences.ClientConfig and a ServiceLayer.svc.cs.

I am debugging by running from the main window and my breakpoints are picked up.

Anyone?


Solution

  • I had some errors in the server side method that were quickly found after debugging was fixed.

    I fixed this, as I said in comments, setting the project to have "Multiple Startup Projects".

    Whenever I had troubles with updating the WCF service methods one of these usually solved it all:

    1 Delete all bin and obj folders (specifically selecting re-build might do the same).

    2 The servicelayer will not succesfully auto-update (but will work!) unless this:

    [ServiceContract(Namespace = "")]
    

    ... is set to this:

    [ServiceContract(Namespace = "YourServiceLayerName")]
    

    3 Right clicking on the servicereference and selecting "update...".

    Sometimes it would stop debugging again, but a forced full re-build would return it to normal.

    I hope this helps someone.