添加 https 绑定后,IIS 中的 Restful WCF(webhttpbinding)中断

发布于 2024-08-13 16:35:41 字数 2088 浏览 3 评论 0原文

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

这是我的相关配置的片段:

<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>

任何建议都表示赞赏。

I have a WCF service hosted in IIS (7.0) which implements multiple service contracts and therefore defines multiple endpoints (one for each contract). It has been working fine but I have just added an https binding to the IIS web application and I am now getting an activation exception specifying that the service implements multiple contracts but no endpoints are defined in configuration when they actually are. I found this article which solves a similar problem caused by adding host names to IIS, but it doesn't seem to help my situation.

Here is a snippet of my configuration which is relevant:

<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>

Any suggestions are appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡忘如思 2024-08-20 16:35:41

如果您为绑定配置 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 传输。

If you are configuring HTTPS for the binding (say SecureRestBindingConfiguration), you also need to set "https" in the address of the the endpoints that you want to expose as https.
e.g.

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

Keyword: https, SecureRestBindingConfiguration

UPDATE:
Assumed you configured https transport within SecureRestBindingConfiguration.

酷到爆炸 2024-08-20 16:35:41

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

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

you can refer this link.. This link helps to give secure with SSL.
Before that you have to install the SSL certificate in your IIS
[enter link description here][1]

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文