C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » WCF »

Consuming wcf from windows application and web application


Posted Date: 15 Oct 2009      Posted By: Sagar      Member Level: Bronze     Points: 1   Responses: 1



How Can we consume a wcf service from windows service and web application at a time?




Responses

Author: Anand Ranganathan    15 Oct 2009Member Level: BronzeRating: 2 out of 52 out of 5     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



Post Reply
You must Sign In to post a response.
Next : Hosting in iis with ipaddress name not machine name
Previous : Wcf - data isolation between services
Return to Discussion Forum
Post New Message
Category: WCF

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use