Wcf “可怕的”;找不到与方案http匹配的基址;如何使它与SSL一起工作?
这个问题被问了很多,但我找到的每一个答案都与我已经应用的东西有关。请提供以下信息,我如何让我的服务与SSL一起工作 我试图使用ajax从WCF服务获取JSONP响应,WCF服务在exchange中连接到中间件服务。我的请求由两个字符串组成 我在web.config中的应用程序BLL下有以下xml,而BLL又位于站点X下:Wcf “可怕的”;找不到与方案http匹配的基址;如何使它与SSL一起工作?,wcf,ssl,Wcf,Ssl,这个问题被问了很多,但我找到的每一个答案都与我已经应用的东西有关。请提供以下信息,我如何让我的服务与SSL一起工作 我试图使用ajax从WCF服务获取JSONP响应,WCF服务在exchange中连接到中间件服务。我的请求由两个字符串组成 我在web.config中的应用程序BLL下有以下xml,而BLL又位于站点X下: <service behaviorConfiguration="ServiceBehavior" name="Locat
<service behaviorConfiguration="ServiceBehavior"
name="LocationService">
<endpoint
address=""
contract="ILocationService"
binding="webHttpBinding"
bindingConfiguration="webHttpBindingWithJsonP"
behaviorConfiguration="webHttpBehavior">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
在配置中再进一步:
<webHttpBinding>
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="true" >
<security mode="Transport" />
</binding>
</webHttpBinding>
服务行为:
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
此应用程序的IIS设置:
- 检查是否需要SSL
- 客户端证书:需要
- 类型:http;港口:80 ;;IP地址:10.xx.xxx.xxx
- 类型:https;港口:443;IP地址:10.xx.xxx.xxx
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
通过更改mex端点以允许使用与我的服务相同的绑定信息(更多信息:)传递安全元数据,错误消失:
<endpoint address="mex" binding="webHttpBinding" name="MetadataBinding" contract="IMetadataExchange" bindingConfiguration="webHttpBindingWithJsonP"/>
我遇到的最后一个问题是,我没有正确设置安全设置。与其说我在问题中写了什么,不如说:
<webHttpBinding>
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="false">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</webHttpBinding>
调整为我提供所需jsonp结果的所有内容
我发现一篇文章详细解释了配置过程:您如何测试您的服务?这个测试的主机是什么?我试图通过一个ajax调用与服务联系,但这对我来说还不够:你在请求什么?我假设您使用的是运行web浏览器的JavaScript,而不是基于WCF的客户端,那么您确定请求的端点正确吗?你是用什么来托管服务的?您能否从IIS Express成功运行测试场景?请参阅我对问题的回答。
<webHttpBinding>
<binding name="webHttpBindingWithJsonP" crossDomainScriptAccessEnabled="false">
<security mode="Transport">
<transport clientCredentialType="Certificate" />
</security>
</binding>
</webHttpBinding>