Answered WCF Multiple Binding Error

  • 2012年5月22日 18:00
     
     

    Hi

    We have hosted and deployed Sharepoint Solution that includes a WCF Service. The WCF service was working fine until I added another binding in IIS. First I got the error:

    "System.ArgumentException: This collection already containsan address with scheme http. An address by, at most schematic possible in this collection."

    and I understood its the .Net Framework 3.5 that doesnt allow multiple bindings for WCF, so I looked for a solution and added the following in my WCF service:

    "Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c""

    But after this, I started to get the following error:

    "A binding instance has already been associated to listen URI "http://xyz.com/_vti_bin/Service/Service.svc ". If two endpoints want to share the same address ListenUri, they must also share the same instance of the binding object. The two conflicting endpoints were either specified in callsAddServiceEndpoint () in a configuration file, or was a combination ofAddServiceEndpoint () and configuration."

    Now, I am stuck here. I have read in some blogs that "Extending the application" is the only solution, but I cant really do that. Because, we might have more than just 2 bindings added in IIS (and the AAM, accordingly) and extending the application for all the bindings will not be possible. 

    What can I do?

    I am sure something might have been thought about for this issue in the SP1. We have the "Sharepoint 2010 for Internet Sites, Standard Edition SP1" installed on the Windows Server 2008 R2 Standard Edition OS.

    Thanks

    Akshaya


    Akshaya K Sharma


全部回复

  • 2012年5月28日 6:13
     
     

    Hi,

    To my knowledge, and I have been doing extensive work with WCF in the last month, you can not share the same exact URI for more than one endpoint. In WCF, a "service" is not defined by the implementation of a contract, but by the contract itself (which also follows WSDL and standard SOA practices.) Endpoints allow you to expose a single service via multiple protocols (and therefor different addresses), but you can not share different services on the same exact address. Logically that wouldn't work.

    For the detailed explanation about this issue, check out the following article:

    http://stackoverflow.com/questions/1475079/wcf-iis-hosted-service-multiple-service-contracts-implemented-by-a-single-servic

    Thanks,

    Rock Wang


    Rock Wang TechNet Community Support

  • 2012年5月29日 6:42
     
     

    Hi,

    To my knowledge, and I have been doing extensive work with WCF in the last month, you can not share the same exact URI for more than one endpoint. In WCF, a "service" is not defined by the implementation of a contract, but by the contract itself (which also follows WSDL and standard SOA practices.) Endpoints allow you to expose a single service via multiple protocols (and therefor different addresses), but you can not share different services on the same exact address. Logically that wouldn't work.

    For the detailed explanation about this issue, check out the following article:

    http://stackoverflow.com/questions/1475079/wcf-iis-hosted-service-multiple-service-contracts-implemented-by-a-single-servic

    Thanks,

    Rock Wang


    Rock Wang TechNet Community Support

    Hello Rock Wang

    I am not looking for sharing the same uri with multiple endpoints but I am looking for the same endpoint being usable from multiple Uris! So, I guess the example you gave above is not applicable in this scenario! Please correct me, if I am wrong!

    Thanks


    Akshaya K Sharma

  • 2012年6月1日 7:29
     
     已答复

    Hi,

    In my opinion, it is impossible to use same endpoint from multiple Uris. You had better to post your issue into WCF forum for a solid answer, thanks for your understanding.

    http://social.msdn.microsoft.com/Forums/en-US/wcf/threads

    Thanks,

    Rock Wang


    Rock Wang TechNet Community Support

  • 2012年6月1日 7:55
     
     

    Hi,

    In my opinion, it is impossible to use same endpoint from multiple Uris. You had better to post your issue into WCF forum for a solid answer, thanks for your understanding.

    http://social.msdn.microsoft.com/Forums/en-US/wcf/threads

    Thanks,

    Rock Wang


    Rock Wang TechNet Community Support

    Ok! I'll.


    Akshaya K Sharma