如何让wcf的配置同时支持http和https

lovingkiss 2019-03-07 01:07:56
<webHttpBinding>
<binding name="HttpBinding" />
<security mode="None">
</security>
</binding>

<binding name="HttpsBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>

bindingConfiguration="HttpBinding" 指向哪一个哪一个可以使用,但是同时另外一个模式就会提示404找不到。
但是我希望两者是都可以随时访问的,因为站点同时是支持两种模式的。
...全文
684 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
lovingkiss 2019-03-07
  • 打赏
  • 举报
回复
引用 2 楼 水边2 的回复:
帮你搜索了一下,解决方案:
https://stackoverflow.com/questions/3824419/how-to-configure-a-single-wcf-service-to-have-multiple-http-and-https-endpoints


这个方法我试过了,当放置两个endpoint的时候,会导致站点提示尝试访问已卸载的 AppDomain,http和https都瘫痪了。
lovingkiss 2019-03-07
  • 打赏
  • 举报
回复
引用 1 楼 水边2 的回复:
印象中,WCF是只能支持一个通道的,包括域名,
比如你的站点绑定了2个域名,
那么WCF只能支持其中一个域名,另一个域名是会报错的。


现在是两个域名是都可以访问到svc页面,只是使用https://localhost/Service.svc/GetDatas 这种方式的时候,每次就只能一个生效,网络上很多配置双通道的办法,都是用webHttpBinding以外的。webHttpBinding里面无法区分两个模式
游北亮 2019-03-07
  • 打赏
  • 举报
回复
帮你搜索了一下,解决方案: https://stackoverflow.com/questions/3824419/how-to-configure-a-single-wcf-service-to-have-multiple-http-and-https-endpoints
游北亮 2019-03-07
  • 打赏
  • 举报
回复
印象中,WCF是只能支持一个通道的,包括域名, 比如你的站点绑定了2个域名, 那么WCF只能支持其中一个域名,另一个域名是会报错的。

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧