WCF获取HTTPS配置

时间:2011-06-07 15:33:43

标签: .net wcf ssl

我正在尝试将我的WCF服务点配置为HTTP并支持2个WCF点(1个常规,1个RESTFUL(GET))。

当我尝试浏览SVC时出现以下错误。

  

无法找到与绑定MetadataExchangeHttpsBinding的端点的方案https匹配的基址。注册的基地址方案是[http]

以下是我的web.config

的相关部分
<bindings>
  <mexHttpsBinding>
    <binding name="mexHttpsBinding1"/>
 </mexHttpsBinding>
 <customBinding>
   <binding name="customBinding0">
     <binaryMessageEncoding>
       <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
     </binaryMessageEncoding>
     <httpTransport maxReceivedMessageSize="4194304" />
   </binding>
   <binding name="customBindingSecure">
     <binaryMessageEncoding>
       <readerQuotas maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxDepth="2147483647" maxNameTableCharCount="2147483647" maxStringContentLength="2147483647" />
     </binaryMessageEncoding>
     <httpsTransport maxReceivedMessageSize="4194304" />
   </binding>
 </customBinding>
     

<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
 <baseAddressPrefixFilters>
   <add prefix="https://myserver1">
   </add>
   <add prefix="http://myserver1">
   </add> 
 </baseAddressPrefixFilters>
</serviceHostingEnvironment>



<behaviors>
 <serviceBehaviors>
   <behavior name="MyService.Web.Services.Private.WebServiceBehavior">
     <serviceMetadata  httpsGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="true" />
   </behavior>
   <behavior name="MyService.Web.Services.Public.WebServiceBehavior">
     <serviceMetadata  httpsGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="true" />
   </behavior>
 </serviceBehaviors>
 <endpointBehaviors>
   <behavior name="ImageBehavior">
     <enableWebScript />
   </behavior>
 </endpointBehaviors>
     

<services>
  <service behaviorConfiguration="MyService.Web.Services.Private.WebServiceBehavior"
    name="MyService.Web.Services.Private.WebService">
    <endpoint address="https" behaviorConfiguration="ImageBehavior"
      binding="webHttpBinding" name="PrivateImageBehaviorHTTPs" contract="MyService.Web.Services.Private.WebService" />
    <endpoint address="mex" binding="mexHttpsBinding" bindingConfiguration="mexHttpsBinding1" name="PrivateMex"
      contract="IMetadataExchange" />
    <endpoint address="https://myserver1/MyService.web.services/private/xifactoryusers.svc"
      binding="customBinding" bindingConfiguration="customBindingSecure"
      name="PrivateXIFactoryUsersHTTPs" contract="MyService.Web.Services.Private.WebService" />
  </service>
  <service behaviorConfiguration="MyService.Web.Services.Public.WebServiceBehavior"
    name="MyService.Web.Services.Public.WebService">
    <endpoint address="https" behaviorConfiguration="ImageBehavior"
      binding="webHttpBinding" name="PublicImageBehaviorHTTPs" contract="MyService.Web.Services.Public.WebService" />
    <endpoint address="mex" binding="mexHttpsBinding"  bindingConfiguration="mexHttpsBinding1" name="PublicMex"
      contract="IMetadataExchange" />
    <endpoint address="https://myserver1/MyService.web.services/public/xifactoryusers.svc"
      binding="customBinding" bindingConfiguration="customBindingSecure"
      name="PublicXIFactoryUsersHTTPs" contract="MyService.Web.Services.Public.WebService" />
  </service>
</services>

IIS绑定很好(IIS设置为带证书的SSL)

感谢您的帮助, 亚历

0 个答案:

没有答案