【发布时间】:2016-09-16 23:18:16
【问题描述】:
我有一个将通过 IIS 部署的 WCF 服务应用程序。
该服务的开发 URL 是 http://localhost:42543/Loyalty.svc,但是当它发布到 Web 服务器时,该 URL 将是 http://ServerName:1066/Loyalty.svc。
但是,当我导航到该 URL 时,我收到以下错误:
找不到与具有绑定 WSHttpBinding 的端点的方案 https 匹配的基地址。注册的基地址方案是 [http]。
说明:在执行当前 Web 请求期间发生未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。
异常详细信息:System.InvalidOperationException:找不到与具有绑定 WSHttpBinding 的端点的方案 https 匹配的基地址。注册的基地址方案是 [http]。
网站的 web.config 在这里:
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="wsSecureBinding">
<security mode="TransportWithMessageCredential">
<message clientCredentialType="UserName"/>
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="default" name="IISService.Loyalty">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="wsSecureBinding" name="secureService" contract="IISService.ILoyalty"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="default">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="IISService.SecurityValidation, IISService"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
</system.serviceModel>
我还使用http://www.c-sharpcorner.com/UploadFile/manas1/implementing-username-password-security-in-wcf-service/ 此处概述的基本传输安全模型。
提前感谢您的帮助。
【问题讨论】:
-
只是一个疯狂的猜测:您还没有为在 IIS 中托管服务的站点配置 https,对吧?
标签: c# web-services wcf iis