wcf - multiple endpoints?

Discussion in 'ASP .Net Web Services' started by Jerry Nettleton, Dec 16, 2008.

  1. 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
     
    Jerry Nettleton, Dec 16, 2008
    #1
    1. Advertising

  2. 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


    "Jerry Nettleton" wrote:

    > 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
     
    Jerry Nettleton, Dec 17, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter

    WCF service multiple connections

    Peter, Oct 17, 2008, in forum: ASP .Net
    Replies:
    3
    Views:
    799
    John Saunders
    Oct 17, 2008
  2. c64

    Undriven Clock Endpoints

    c64, May 13, 2009, in forum: VHDL
    Replies:
    0
    Views:
    495
  3. Simon
    Replies:
    0
    Views:
    1,025
    Simon
    Oct 13, 2009
  4. Cindy Lee
    Replies:
    1
    Views:
    2,124
    Mr. Arnold
    Mar 19, 2010
  5. Replies:
    2
    Views:
    335
Loading...

Share This Page