none
Help on configuring WCF REST with SSL RRS feed

  • Question

  • I have WCF REST service configured in IIS7. Service is set to use SSL.  Below is the <system.serviceModel> section. When i try to browse service in IIS im getting following error. But i dont have two endpoints setup in config file, so not sure why error says two endpoints. Note that the basicHttpBinding is used by <Client> endpoints not by the <Service> endpoint

    A binding instance has already been associated to listen URI 'https://XXXXXXXX'. If two endpoints want to share the same ListenUri, they must also share the same binding object instance. The two conflicting endpoints were either specified in AddServiceEndpoint() calls, in a config file, or a combination of AddServiceEndpoint() and config.


      <system.serviceModel>
        <services>
          <service name="GatewayService">
            <endpoint address=""
                      contract="ServiceGateway.IGatewayService"
                      binding="webHttpBinding"/>
          </service>
        </services>
        <bindings>
          <webHttpBinding>
            <binding>
              <security mode="Transport" />
            </binding>
          </webHttpBinding>
          <basicHttpBinding>
            <binding name="BasicHttpEndPoint" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:10:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="2147483647" maxBufferPoolSize="524288" maxReceivedMessageSize="2147483647"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
              <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="2147483647"
                  maxBytesPerRead="4096" maxNameTableCharCount="16384" />
              <security mode="None">
                <transport clientCredentialType="None" proxyCredentialType="None"
                    realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
              </security>
            </binding>
          </basicHttpBinding>
        </bindings>
        <client>
          <endpoint address="http://localhost/Services/DownloadPackageService.xamlx"
              binding="basicHttpBinding" bindingConfiguration="BasicHttpEndPoint"
              contract="DownloadPackageService.IDownloadPackageService"
              name="DownloadPackageEndPoint" />
    
          <endpoint address="http://localhost/Services/RenderingService.xamlx"
            binding="basicHttpBinding" bindingConfiguration="BasicHttpEndPoint"
            contract="RenderingService.IRenderingService"
            name="RenderDocumentEndPoint" />
        </client>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
        <standardEndpoints>
          <webHttpEndpoint>
            <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
          </webHttpEndpoint>
        </standardEndpoints>
      </system.serviceModel>


    • Edited by lax4u Wednesday, May 15, 2013 4:23 PM
    Wednesday, May 15, 2013 4:23 PM

Answers

All replies

  • Hi,

    It seems that your code should work.

    The following thread is similar to your, it throw the error as yours when it use the .Net 4.5 but work fine in .Net 4.

    http://forums.asp.net/t/1847039.aspx/1 .

    So are you using the .Net4.5?

    If so could you please test your code in .Net 4 to see if it works.

    Best Regards.


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, May 17, 2013 8:25 AM
    Moderator
  • I'm using .Net 4.  Also note that i get this error as soon a enabled the web service for SSL. If i set IIS not to use SSL and then set Security mode="None" then everything is working finen

    Below if the code in global.asax file that runs at startup

        public class Global : HttpApplication
        {
            public void Application_Start(object sender, EventArgs e)
            {
                RouteTable.Routes.Add(new ServiceRoute(string.Empty, new WebServiceHostFactory(), typeof(GatewayServiceHost)));
            }
        }
    





    • Edited by lax4u Monday, May 20, 2013 8:56 PM
    Monday, May 20, 2013 2:58 PM
  • Hi,

    In my mind it should work in the .net 4.0.

    Maybe you have run your 4.0 application on your computer which have the .net 4.5 installed.

    For this error occur on the .net 4.5, there is the update solution:

    http://support.microsoft.com/kb/2805227 .

    Hope it can help you.

    Best Regards.


    Amy Peng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, May 22, 2013 1:55 AM
    Moderator