| Author: Anand Ranganathan 15 Oct 2009 | Member Level: Bronze | Rating:  Points: 2 |
Hi Sagar ,
So from your question I understand you are looking to consume a WCF service by multiple client applications in this case it is Windows service and a Webservice. Here are few points that you need to consider when it comes to consuming a WCF Service :
1. Make sure you have hosted your WCF Service successfully [ie., in IIS or Managed Application or Windows Service etc] with all the parameters of Address,Binding and Contract [ABC's] for an endpoint in your service's config file configured correctly.
2. Make sure you also accomodate Metadata Exchange for your service in the service's config file . [For example, <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> ] to allow the exchange of metadata/WSDL with the client application.
3. Also make sure you enable the <serviceMetadata httpGetEnabled="True"/> in the service's config file .
4. With that , your service should be exposed fine to begin the process of consumption . Choose the option called 'Add Service Reference' from Solution Explorer by right clicking on the webservice and on the webapplication project nodes in your Visual Studio Editor. Then enter the address of your service created in steps 1,2,3. [Note : you can alternatively use svcutil.exe to create your proxy class]
5. Then from your code you should be able to call your WCF service by creating an object for the proxy class of your service by passing endpoint configuration name present in the config file of your client application as a parameter in the constructor while creating the proxy class's object.
I hope this post answers your question.
Anand
|