c# WCF服务应用程序基地址问题
本文关键字:基地址 问题 应用程序 服务 WCF | 更新日期: 2023-09-27 18:07:30
我有一个WCF服务应用程序,它将通过IIS部署。
服务的开发URL是http://localhost:42543/Loyalty.svc,但是当它发布到web服务器时,URL将是http://ServerName:1066/Loyalty.svc。
然而,当我导航到URL时,我得到以下错误:
无法找到与绑定WSHttpBinding的端点的方案https匹配的基地址。[http].
描述:当前web请求执行过程中出现未处理的异常。请查看堆栈跟踪以获得有关错误及其在代码中的起源位置的更多信息。
Exception Details: System。InvalidOperationException:无法找到与绑定WSHttpBinding的端点的方案https匹配的基地址。[http].
网络。此处为站点配置:
<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/。
提前感谢您的帮助。
听起来你的服务器没有为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