【问题标题】:How to consume HTTPS service having following binding configurations?如何使用具有以下绑定配置的 HTTPS 服务?
【发布时间】:2013-06-19 19:17:17
【问题描述】:

以下是WCF的web.config中serviceModel的配置方式:

<system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="basicHttpWithSecure">
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Basic"></transport>
          </security>
        </binding>
      </basicHttpBinding>

    </bindings>
    <services>
      <service name="CMA.Customers">
        <endpoint name="basic" binding="basicHttpBinding" contract="CMA.Customers" bindingConfiguration="basicHttpWithSecure"></endpoint>
      </service>      
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpsGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false" />          
        </behavior>
      </serviceBehaviors>
    </behaviors>

    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
  </system.serviceModel>

此服务部署在 IIS 上,我可以使用 url 访问它 - https://www.companyname.co.uk/sitename/wcfservicename/service.svc 此 WCF 在 IIS 中的身份验证设置为“匿名”和“基本”。

现在我在同一个站点上部署了一个 MVC 应用程序,我想指向该 MVC 站点来使用这个 WCF。如何在我的 MVC 站点的 web.config 中配置它?

或者您认为需要对 WCF 的配置进行任何更改才能使其成为可能?

【问题讨论】:

    标签: wcf https web-config basichttpbinding


    【解决方案1】:

    更改您的安全模式:

    <security mode="TransportCredentialOnly">
    

    <security mode="Transport">
    

    因为 TransportCredentialOnly 用于基于 http 的客户端身份验证。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-29
      • 2012-06-19
      • 2015-10-15
      • 1970-01-01
      • 2014-09-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多