Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Apr 02, 2012 03:55 AM by Steven Cheng - MSFT
Mar 31, 2012 11:59 AM|LINK
I am new to the WCF and facing some little problem. Initially, I just used the WCF service template for the test service. There are two default OperationContract as below:
string GetData(int value);
CompositeType GetDataUsingDataContract(CompositeType composite);
Initially both are also exposing at the client side in the intellicense and I can consume these services. But as I added a new contract like below:
Product GetDataUsingProductContract(int id);
For this class in the same assembly
public class Product
public int ProductId
public string PName
After adding these methods I have implemented it like bleow:
public Product GetDataUsingProductContract(int Id)
Product P = new Product();
P.ProductId = Id;
P.PName = "Here is the product";
and follow the simple steps to update the reference file:
1) Rebuild the service application
2) Update the service refrence file in the client application
But after follow these steps, the new method "GetDataUsingProductContract" is not exposing at the client side. This method will only exposed when I delete the proxy file (generateproxy.cs) and add again using the SVCUtil.exe. I think there should be some
technique to update the service references file without recreating it.
I am using visual studio 2010 and it is also do not work in 2008.
My client side code is :
static void Main(string args)
Service1Client S = new Service1Client();
Thanks in advance !
Apr 01, 2012 02:37 PM|LINK
Add a service reference in your client application by right-clicking the project and choose "Add Service Reference". You will then be able to update the service reference by right-clicking on it and choose "Update Service reference".
If you are creating a proxy class through the svcutil utility you need to re-generate the proxy class each time your service is modified.
Apr 02, 2012 03:55 AM|LINK
As mm10 suggested, you can right click the existing "service reference" in Visual Studio IDE and use "Update Service Reference" to update it.
#How to: Add, Update, or Remove a Service Reference
and the updating operation is also relying on the metadata document of the WCF service. Therefore, you can use webbrowser to view the metadata document(WSDL) of your WCF service after you made any changes. If the metadata document does contains the new added
operation defintions, then the service definition is updated and the client should be able to regenerate the proxy based on the new metadata.