Thursday 20 January 2011

Update your WCF service proxy class

I have had a hard time updating  a WCF service (adding a new method to it) I used in a SharePoint/Silverlight project (the Silverlight application uses the WCF service to get data from SharePoint).

I found a solution. However it is rather strange and doesn't make much sense.
Anyway here it goes...

My setup:
  • WCF Service Library on the server.
  • SharePoint project with a .svc file pointing to the WCF Service Library.
  • The Silverlight application connects to service (the .svc files url).

Solution (short version):
  1. Implement the new method in the WCF Service Library (remember to do this in the interface/contract as well as the implementation of the interface).
  2. Deploy the SharePoint project (I think its strange that this step is nessesarry!)
  3. Start the WCF test client in Visual Studio
  4. Update the proxy class (I used the slsvcutil.exe tool).

WCF test client in Visual Studio - copy the mex address of the service


Use the slsvcutil.exe to generate the WCF service proxy class (for Silverlight)
There is also a svcutil.exe tool, which is used in normal .net applications

No comments:

Post a Comment