添加 https 绑定后,IIS 中的 Restful WCF(webhttpbinding)中断
我有一个托管在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您为绑定配置 HTTPS(例如 SecureRestBindingConfiguration),则还需要在要公开为 https 的端点的地址中设置“https”。
例如
关键字: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.
Keyword: https, SecureRestBindingConfiguration
UPDATE:
Assumed you configured https transport within SecureRestBindingConfiguration.
您可以参考此链接。此链接有助于通过 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/