我正在尝试使用两个 endpoints 设置WCF服务,这两个 endpoints 都公开相同的服务 Contract ,如下所示

我希望接触到客户......

http://server:1955/myService/secondEndpointhttps://server:443/myService/

问题似乎是多个基地址 .

如果我在每个 endpoints 中明确指定完整地址并省略baseAddress部分,则会出现以下错误

“当'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled'在配置中设置为true时, endpoints 需要指定相对地址 . 如果要在 endpoints 上指定相对侦听URI,则地址可以是绝对的 . 要解决此问题,请为 endpoints 指定相对uri 'http://server:1955/myService/secondEndpoint' . “

因此,我将相对地址放在 endpoints 中并添加基址

找不到与绑定WSHttpBinding的 endpoints 的方案https匹配的基址 . 注册的基地址方案是[http] .

我觉得我和这个人在一起 . 任何帮助非常感谢 .

<system.serviceModel> 
    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpBindingConfiguration" 
                 maxBufferPoolSize="2147483647" 
                 maxBufferSize="2147483647" 
                 maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="2147483647" 
                        maxStringContentLength="2147483647" 
                        maxArrayLength="2147483647" 
                        maxBytesPerRead="2147483647" 
                        maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
      <wsHttpBinding>
        <binding name="wsHttpBindingConfiguration" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
         <readerQuotas maxDepth="2147483647"
                        maxStringContentLength="2147483647"
                        maxArrayLength="2147483647"
                        maxBytesPerRead="2147483647"
                        maxNameTableCharCount="2147483647" />
         <security mode="Transport" >
          <transport clientCredentialType="Windows"   />
         </security>
        </binding>
      </wsHttpBinding>  
    </bindings>
    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior">
          <dataContractSerializer maxItemsInObjectGraph="2147483647" />
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true" />
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <protocolMapping>
        <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>  
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    <services>
      <service behaviorConfiguration="ServiceBehavior" name="myService">
        <endpoint address="nonsecure" 
                  binding="basicHttpBinding" 
                  bindingConfiguration="basicHttpBindingConfiguration" 
                  contract="ImyService" 
                  name="myService" />
        <endpoint address="https://server:443/myService.svc"
                  binding="wsHttpBinding"
                  bindingConfiguration="wsHttpBindingConfiguration"
                  contract="ImyService"
                  name="myService" />
        <host>
          <baseAddresses>
            <add baseAddress="http://server:1955/myService/" />
            <add baseAddress="https://server:443/myService/" />
          </baseAddresses>
        </host>
      </service>
    </services>
  </system.serviceModel>