wcf - multiple endpoints?


J

Jerry Nettleton

I have a web client with a reference to a WCF service (added using 'add
service reference...'). During development, I want to use localhost and then
later deploy it to another web server. So I created multiple endpoints as
shown:

<system.serviceModel>
<client>
<endpoint address="http://myapp_dev/SoaServices/MyService.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IMyService"
contract="MyServiceReference.IMyService" name="webMyService" />
<endpoint address="http://localhost:3885/MyService.svc"
binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_IMyService"
contract="MyServiceReference.IMyService" name="localMyService" />
</client>
</system.serviceModel>

When I add code to use the local endpoint:

MyServiceClient psc = new MyServiceClient("localMyService");

I always get an error message:

"Could not find endpoint element with name 'localMyService' and contract
'MyServiceReference.IMyService' in the ServiceModel client configuration
section. This might be because no configuration file was found for your
application, or because no endpoint element matching this name could be found
in the client element."

I have tried using the full name (including the namespace) but that doesn't
work.

Any other thoughts on how to resolve this error?

Can you recommend another way to debug/develop the client and service using
VS 2008 and then later build the code for deployment?

Thanks,
Jerry
 
Ad

Advertisements

J

Jerry Nettleton

I found a solution (by trial and error) which corrects the 'Add Service
Reference..." wizard problems:

1) add namespace to ServiceContractAttributein "Reference.cs":
from
[System.ServiceModel.ServiceContractAttribute
(ConfigurationName="MyServiceReference.IMyService")]
to
[System.ServiceModel.ServiceContractAttribute
(ConfigurationName="MyNamespace.MyServiceReference.IMyService")]

2) added namespace to contract in "web.config":
from
contract="MyServiceReference.IMyService"
to
contract="MyNamespace.MyServiceReference.IMyService"


From the original message:

Can you recommend another way to debug/develop the client and service using
VS 2008 and then later build the code for deployment?


Thanks,
Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top