WCF Bindings Needed For HTTPS
原文地址: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的更多相关文章
- 通过配置web.config使WCF向外提供HTTPS的Restful Service
如何通过WCF向外提供Restful的Service请看如下链接 http://www.cnblogs.com/mingmingruyuedlut/p/4223116.html 那么如何通过对web. ...
- 引用WCF地址报下载“https://xxx:8004/TerminalHandler.svc?disco”时出错问题
服务发布了wcf服务后,在客户端引用发现出现以下错误 - 来自“DISCO 文档”的报告是“下载“https://servername:8004/TerminalHandler.svc?disco”时 ...
- WCF 客户端 BasicHttpBinding 兼容 HTTPS 和 HTTP
背景:全站HTTPS的时代来了 全站HTTPS,请参考:http://www.cnblogs.com/bugly/p/5075909.html 1. 设置BasicHttpBinding的BasicH ...
- WCF自寄宿实现Https绑定
一.WCF配置 1 Address 将服务端发布地址和客户端访问地址都配置为https开始的安全地址.参考如下. <add key="SrvUrl" value=" ...
- WCF bindings comparison z
Binding Protocol/Transport Message Encoding Security Default Session Transaction Duplex BasicHttpBin ...
- WCF发布到IIS 7.0,并以https访问
一.IIS 7.0中如何生成服务器证书,并要求网站以http访问可参考: http://www.cnblogs.com/chnking/archive/2008/10/07/1305811.html ...
- WCF basicHttpBinding之Transport Security Mode, clientCredentialType="None"
原创地址:http://www.cnblogs.com/jfzhu/p/4071342.html 转载请注明出处 前面文章介绍了<WCF basicHttpBinding之Message Sec ...
- WCF学习系列三--【WCF Interview Questions – Part 3 翻译系列】
http://www.topwcftutorials.net/2012/10/wcf-faqs-part3.html WCF Interview Questions – Part 3 This WCF ...
- WCF系列(六) - WCF安全系列(一) - basicHttpBinding
绑定可指定在与终结点通话时所使用的通信机制,并指示如何连接到终结点.绑定由一些元素组成,这些元素指定如何对 Windows Communication Foundation (WCF) 通道进行分层以 ...
- 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 ...
随机推荐
- .net6 使用gRPC示例
创建一个gRPC服务项目(grpc服务端)和一个 webapi项目(客户端),测试项目结构如下: 公共模型 测试接口相关类,放在公共类库中,方便服务端和客户端引用相同模型 public class R ...
- SXYZ-12天集训
Day 1(6月25日) 早上四点多钟起床做七点到九点四十的飞机到杭州萧山(空客330) 然后坐一小时车到绍兴一中对面的酒店. 中午曾老师请我们在酒店隔壁吃了一桌家常菜(味道可以),以此庆祝曾老师52 ...
- 简单上手 Vue Router
Vue Router 也随着 Vue3 的更新来到了 4 版本,来看一下怎么使用吧!(这里使用的是 composition API 和 TypeScript 模式) 安装 vue-router4 np ...
- ptmalloc、tcmalloc与jemalloc对比分析
背景介绍 在开发微信看一看期间,为了进行耗时优化,基础库这层按照惯例使用tcmalloc替代glibc标配的ptmalloc做优化,CPU消耗和耗时确实有所降低.但在晚上高峰时期,在CPU刚刚超过50 ...
- abc292[AtCoder Beginner Contest 292] 题解
写点题目转换下心情吧 A-CAPS LOCK 大水题 B-Yellow and Red Card 大水题 C-Four Variables 给定一个数\(N\),问有多少个有序正数数组\((A,B,C ...
- logback.xml文件
<?xml version = "1.0" encoding="UTF-8"?> <configuration debug = "f ...
- jenkins + sonar 实现代码检测的配置
一.首先安装sonar scanner的客户端 我的jenkins版本为2.176.2 安装sonar需要安装客户端和服务端,这里只讲述客户端的相关配置.安装步骤省略 二.然后配置sonar scan ...
- 立即报名 | 云原生 + AI Meetup 成都站 11.4 正式开启
2023 年,KubeSphere 社区已经在深圳.杭州.上海三个城市各组织了一场线下 Meetup.第四站,我们将走进天府成都. 11 月 4 日,云原生 + AI Meetup 成都站将正式开启! ...
- KubeSphere 社区双周报 | OpenFunction 支持 Dapr 状态管理 | 2023.03.31-04.13
KubeSphere 社区双周报主要整理展示新增的贡献者名单和证书.新增的讲师证书以及两周内提交过 commit 的贡献者,并对近期重要的 PR 进行解析,同时还包含了线上/线下活动和布道推广等一系列 ...
- JavaScript网页设计案例
1.引言 在前端开发中,JavaScript 无疑是一个非常重要的语言.它不仅可以用于表单验证.动态内容更新,还能实现复杂的交互效果和动画.通过 JavaScript,网页变得更加生动和富有互动性.本 ...