无法为一个WCF服务公开两个端点

时间:2017-09-21 13:03:34

标签: wcf iis endpoint

我正在尝试设置一个带有两个端点的WCF服务,这两个端点都公开相同的服务合同,如下所示

我想要接触客户......

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

问题似乎是多个基地址。

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

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

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

无法找到与绑定WSHttpBinding的端点的方案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>

0 个答案:

没有答案