Reputation:
I have a WCF Service (with installer) that I have built and installed in Windows Services. Opened up Admin Tools, Services, and started the service without a problem.
So now I'm beginning a new project (a simple Windows forms app). I want to consume my new WCF, but have no idea how. I can't seem to add a reference / add a service reference to it.
Any help would be greatly appreciated.
Thanks, Jason
Upvotes: 0
Views: 373
Reputation: 755227
When the Windows service hosting your WCF service is up and running and properly configured, you should be able to use either Visual Studio's Add Service Reference
or the command-line svcutil
tool to connect to that service.
Just type in the address where the service lives.
This requires that your service has metadata exchange enabled (as a service behavior) as well as provides at least one MEX (Metadata Exchange) endpoint in its config. Do you have those available??
Service behavior:
<behaviors>
<serviceBehaviors>
<behavior name="mex">
<serviceMetadata />
</behavior>
</serviceBehaviors>
</behaviors>
and then your service must reference this configuration.
Service config:
<services>
<service name="YourService"
behaviorConfiguration="mex"> <!-- reference the service behavior with the serviceMetadata element ->
<endpoint .... (your regular endpoint here) />
<endpoint name="mex"
address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
Upvotes: 1