【发布时间】:2019-03-31 00:49:15
【问题描述】:
在 WCF REST Web 服务上启用 HTTPS
我已经尝试了多种配置,但我无法让我的 WCF 休息网络服务通过 HTTPS 工作。我收到 500 个内部错误或 400 个错误请求。
我在 IIS 中添加了一个新网站,绑定到端口 80 和 443。然后,启用 http/https 协议。
这是我的 Web.config:
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<services>
<service name="RestService.MyService">
<endpoint address="https://mywebsite.com"
binding="webHttpBinding" contract="RestService.IMyService" />
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior>
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
</system.serviceModel>
<startup>
<supportedRuntime version="v4.5" sku=".NETFramework,Version=v4.5.1"/>
</startup>
<system.diagnostics>
<sources>
<source name="System.ServiceModel" switchValue="Information,ActivityTracing"
propagateActivity="true">
<listeners>
<add name="xml" />
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging">
<listeners>
<add name="xml" />
</listeners>
</source>
</sources>
<sharedListeners>
<add initializeData="C:\logs\TracingAndLogging-service.svclog" type="System.Diagnostics.XmlWriterTraceListener"
name="xml" />
</sharedListeners>
<trace autoflush="true" />
</system.diagnostics>
</configuration>
【问题讨论】:
标签: wcf iis iis-6 wcf-binding wcf-rest