【发布时间】:2019-03-27 14:44:36
【问题描述】:
我有一个 WCF 服务,它可以用作休息和肥皂。 我正在尝试通过 HTTPS 协议接收请求,但无论我尝试了什么都无法接收。
我已经尝试根据这篇帖子修改 web.config 文件:
How to enable HTTPS in WCF service
我尝试了其他几种我在网上找到的类似方法。 但无论我做什么,我总是得到: “找不到与绑定 WSHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 [https]。” 在调试模式下运行项目时出错。
我的配置如下:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SendEmailSoap" />
<binding name="SendSMSSoap" />
<binding name="KPSPublicSoap">
<security mode="Transport" />
</binding>
<binding name="KPSPublicSoap1" />
</basicHttpBinding>
<webHttpBinding>
<binding name="WebBinding">
<security mode="None">
<transport clientCredentialType="None" />
</security>
</binding>
</webHttpBinding>
<wsHttpBinding>
<binding name="WsBinding">
<security mode="None" />
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp />
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="servicebehaviors">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="integrationServiceBehaviour">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
<serviceCredentials>
<userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="KaporaWebService.App_Code.CustomValidator, App_Code" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="integrationServiceBehaviour" name="KaporaWebService.IntegrationService">
<endpoint address="/ws" binding="wsHttpBinding" bindingConfiguration="WsBinding" contract="KaporaWebService.IIntegrationService" />
<endpoint address="" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="WebBinding" contract="KaporaWebService.IIntegrationService" />
</service>
</services>
<protocolMapping>
<add binding="basicHttpsBinding" scheme="https" />
</protocolMapping>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="false" />
</system.serviceModel>
我需要做什么才能在 WCF 上启用 HTTPS?
【问题讨论】:
标签: c# .net web-services wcf https