原文地址:https://weblogs.asp.net/srkirkland/wcf-bindings-needed-for-https

我刚刚完成了我的第一个 WCF 应用,它在我的开发机上顺利工作,直到我将它部署到产品环境下。所有的 WCF 服务突然都不工作了。我得到的是一个 javaScript 错误 TestService is not defined

当我深入查看 JS 服务引用的时候,我得到这样的一个错误:

Could not find a base address that matches scheme http for the endpoint with binding WebHttpBinding. Registered base address schemes are [https]

所以,我的 WCF 服务将它自身注册为 HTTPS (因为它基于 SSL),但是我仅仅为 HTTP 配置了绑定。解决方案是在你的 web.config 中定义一个订制的支持 HTTPS 的 webHttpbinding 绑定,它的安全模式配置为 Transport。然后你需要在你的端点定义中使用 bindingConfiguration 指向你的订制绑定。

第一步,定义一个支持 HTTPS 的绑定,它的安全模式配置为传输层控制,绑定的名称为 webBinding

<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>

然后,在 service 上使用该绑定,

<service name="TestService">
<endpoint address="" behaviorConfiguration="TestServiceAspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="TestService" />
</service>

完整的支持 HTTPS 的 system.serviceModel 配置节如下所示:

<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="TestServiceAspNetAjaxBehavior">
<enableWebScript />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
<services>
<service name="TestService">
<endpoint address="" behaviorConfiguration="TestServiceAspNetAjaxBehavior"
binding="webHttpBinding" bindingConfiguration="webBinding" contract="TestService" />
</service>
</services>
<bindings>
<webHttpBinding>
<binding name="webBinding">
<security mode="Transport">
</security>
</binding>
</webHttpBinding>
</bindings>
</system.serviceModel>

希望能够帮助遇到类似问题的朋友。

WCF Bindings Needed For HTTPS的更多相关文章

  1. 通过配置web.config使WCF向外提供HTTPS的Restful Service

    如何通过WCF向外提供Restful的Service请看如下链接 http://www.cnblogs.com/mingmingruyuedlut/p/4223116.html 那么如何通过对web. ...

  2. 引用WCF地址报下载“https://xxx:8004/TerminalHandler.svc?disco”时出错问题

    服务发布了wcf服务后,在客户端引用发现出现以下错误 - 来自“DISCO 文档”的报告是“下载“https://servername:8004/TerminalHandler.svc?disco”时 ...

  3. WCF 客户端 BasicHttpBinding 兼容 HTTPS 和 HTTP

    背景:全站HTTPS的时代来了 全站HTTPS,请参考:http://www.cnblogs.com/bugly/p/5075909.html 1. 设置BasicHttpBinding的BasicH ...

  4. WCF自寄宿实现Https绑定

    一.WCF配置 1 Address 将服务端发布地址和客户端访问地址都配置为https开始的安全地址.参考如下. <add key="SrvUrl" value=" ...

  5. WCF bindings comparison z

    Binding Protocol/Transport Message Encoding Security Default Session Transaction Duplex BasicHttpBin ...

  6. WCF发布到IIS 7.0,并以https访问

    一.IIS 7.0中如何生成服务器证书,并要求网站以http访问可参考: http://www.cnblogs.com/chnking/archive/2008/10/07/1305811.html ...

  7. WCF basicHttpBinding之Transport Security Mode, clientCredentialType="None"

    原创地址:http://www.cnblogs.com/jfzhu/p/4071342.html 转载请注明出处 前面文章介绍了<WCF basicHttpBinding之Message Sec ...

  8. WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】

    http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...

  9. WCF系列(六) - WCF安全系列(一) - basicHttpBinding

    绑定可指定在与终结点通话时所使用的通信机制,并指示如何连接到终结点.绑定由一些元素组成,这些元素指定如何对 Windows Communication Foundation (WCF) 通道进行分层以 ...

  10. Adapter as a WCF Binding - In Depth

    WCF LOB Adapter SDK surfaces an adapter as a custom WCF Binding.  A WCF Bindingcorresponds to the “H ...

随机推荐

  1. linux内核空间进程为什么无论如何切换,内核地址空间转换到物理地址的关系是永远不变的?

    在Linux内核中,无论如何切换进程,内核地址空间转换到物理地址的关系是永远不变的,主要原因是内核地址空间在所有进程中是共享的.这种设计有几个关键点: 1. 内核地址空间共享 在Linux操作系统中, ...

  2. Java日期时间API系列31-----Jdk8中java.time包中的新的日期时间API类,时间戳的获取方式对比、转换和使用。

    时间戳是指格林威治时间1970年01月01日00时00分00秒起至现在的总毫秒数,是所有时间的基础,其他时间可以通过时间戳转换得到.Java中本来已经有相关获取时间戳的方法,Java8后增加新的类In ...

  3. 007 Python、Anaconda、pip、Pycharm、Jupyter都是啥?

    博客配套视频链接: https://space.bilibili.com/383551518?spm_id_from=333.1007.0.0 b 站直接看 配套 github 链接:https:// ...

  4. ARM 版 OpenEuler 22.03 部署 KubeSphere v3.4.0 不完全指南

    作者:运维有术 前言 知识点 定级:入门级 KubeKey 安装部署 ARM 版 KubeSphere 和 Kubernetes ARM 版 KubeSphere 和 Kubernetes 常见问题 ...

  5. 使用 KubeSphere 应用商店 5 分钟内快速部署 JuiceFS

    作者:朱唯唯,尹珉 JuiceFS 简介 JuiceFS 是为海量数据设计的分布式文件系统,使用对象存储来做数据持久化,避免重复造轮子,还能大大降低工程复杂度,让用户专注解决元数据和访问协议部分的难题 ...

  6. 欢迎体验程序员Lingma的助攻手

    如果你是一位软件开发者,(同义灵码)Lingma可以帮助你做基础架构的脚手架相关工作事宜以及部分代码开发,对比之前没有灵码,现在提效了她可以给予你零编码的快感,准确快速地读懂了你我的需求,例如答问场景 ...

  7. 向AWS迁移系统

    向AWS迁移系统的考虑事项: 1.理解现在应用的架构和运行环境:   使用的OS,软件版本,依赖库,底层硬件,数据库,资源使用用量.性能等非功能要件.   基于这些信息设计在AWS上的架构,使用Ins ...

  8. DPaRL:耶鲁+AWS出品,开放世界持续学习场景的新解法 | ECCV'24

    来源:晓飞的算法工程笔记 公众号,转载请注明出处 论文: Open-World Dynamic Prompt and Continual Visual Representation Learning ...

  9. kubectl常用命令(一)

    一.查看 1.查看集群状态 # 查看客户端及服务端程序版本信息 kubectl version --short=true 

  10. CF939 D

    CF939 D 让你把区间分成 \(k\) 段, 段内用 \(xor\) 连接, 段之间用 \(or\) 连接,问你在结果不大于 \(x\) 的前提下, \(k\) 的最大值 \(1 \leq n \ ...