【问题标题】:Restful WCF (webhttpbinding) in IIS breaks after adding https binding添加 https 绑定后,IIS 中的 Restful WCF (webhttpbinding) 中断
【发布时间】:2010-12-21 11:52:02
【问题描述】:

我有一个托管在 IIS (7.0) 中的 WCF 服务,它实现了多个服务合同,因此定义了多个端点(每个合同一个端点)。它一直工作正常,但我刚刚向 IIS Web 应用程序添加了一个 https 绑定,现在我得到一个激活异常,指定该服务实现了多个合同,但实际上没有在配置中定义端点。我发现 this 文章解决了向 IIS 添加主机名引起的类似问题,但它似乎对我的情况没有帮助。

这是我的相关配置的 sn-p:

<serviceHostingEnvironment aspNetCompatibilityEnabled="true">
  <baseAddressPrefixFilters>
    <add prefix="http://localhost/CDC.WebPortal.MidTierAccessService/"/>
  </baseAddressPrefixFilters>
</serviceHostingEnvironment>


<services>
  <service name="CDC.WebPortal.MidTier.MidTierAccessService"
           behaviorConfiguration="MidTierServiceBehaviour" >

    <endpoint address="http://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc"
              binding="webHttpBinding" bindingName="RestBindingConfiguration"
              contract="CDC.WebPortal.ServiceContract.IProductService"/>

    <endpoint address="http://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc/Category" binding="webHttpBinding" 
              bindingName="RestBindingConfiguration"
              contract="CDC.WebPortal.ServiceContract.ICategoryService"/>

    <endpoint address="http://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc/Account" binding="webHttpBinding" 
              bindingName="RestBindingConfiguration"
              contract="CDC.WebPortal.ServiceContract.IAccountService"/>

    <endpoint address="http://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc/Order"
              binding="webHttpBinding" bindingName="RestBindingConfiguration"
              contract="CDC.WebPortal.ServiceContract.IOrderService"/>

    <endpoint address="http://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc/mex"
              binding="mexHttpBinding" contract="IMetadataExchange" />

  </service>
</services>

欢迎提出任何建议。

【问题讨论】:

    标签: wcf iis binding https


    【解决方案1】:

    您可以参考此链接。此链接有助于通过 SSL 提供安全性。 在此之前,您必须在 IIS 中安装 SSL 证书 [在此处输入链接描述][1]

    [1]:http://taciturndiscourse.com/services/ssl-for-webhttpbinding/

    【讨论】:

      【解决方案2】:

      如果您正在为绑定配置 HTTPS(例如 SecureRestBindingConfiguration),您还需要在要公开为 https 的端点的地址中设置“https”。 例如

      <endpoint address="https://localhost/CDC.WebPortal.MidTierAccessService/MidTierAccessService.svc"
                        binding="webHttpBinding" bindingName="SecureRestBindingConfiguration"
                        contract="CDC.WebPortal.ServiceContract.IProductService"/>
      

      关键字:https、SecureRestBindingConfiguration

      更新: 假设您在 SecureRestBindingConfiguration 中配置了 https 传输。

      【讨论】:

      • 我实际上并没有将 https 用于该服务,而是将 https 绑定添加到它运行的另一个站点的 iis Web 应用程序。我意识到我可以在没有 https 绑定的情况下创建另一个 Web 应用程序以用于服务,但是我想知道为什么会出现这个问题以及是否可以修复它。
      猜你喜欢
      • 2014-01-26
      • 1970-01-01
      • 2011-03-05
      • 1970-01-01
      • 2023-03-21
      • 1970-01-01
      • 2020-06-19
      • 2015-10-15
      • 2010-11-23
      相关资源
      最近更新 更多