Friday, July 18, 2008

Silverlight: Beware of the Contract

WCF webservice in a silverlight project debugging.


Project build will succeed with 1 warning:

Warning 1 Custom tool warning: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.


This warning refers to the file Reference.svcmap Line 1 Column 1.


When you do run the project you will get:

The remote server returned an unexpected response: (404) Not Found.


This is a pretty good indicator that the web service is not being found. Why? It's looking in the wrong place of course. This is the second time that ServiceReferences.ClientConfig has caused me problems. The solution to resolve the above errors is to simply open up the ServiceReferences.ClientConfig in you Silverlight application, and point the to the correct location of your webservice. Last time I had my project open, the service was running on port 1786, now the port changed to 1408, thus an entirely different location.



Another place to look is under the Web.config file in the website project. Look for all the endpoint addresses, and check to make sure they are correct.
Hope this post helps your debug! Cheers

No comments: