我有一个WCF服务应用程序,它将通过IIS部署。
该服务的开发网址为http://localhost:42543/Loyalty.svc,但在将其发布到网络服务器时,该网址将为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/。
提前感谢您的帮助。
答案 0 :(得分:0)
听起来您没有为HTTPS配置各自的服务器。
IIS需要配置HTTPS的端口绑定。看到 https://msdn.microsoft.com/en-us/library/hh556232%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
Cassini不支持SSL,但不起作用。 IIS Express需要在Visual Studio中启用SSL。见http://www.codeproject.com/Tips/723357/Enabling-SSL-with-IIS-Express-in-Visual-Studio