我正在編寫支持SOAP和REST的WCF Web服務。我還啓用了WCF REST幫助頁面,這對Web服務的使用者非常有用。由於我在IIS和web.config中啓用了SSL(請參閱下文),我無法再獲取WCF REST幫助頁面。如果我訪問https://myHost/myWebService/help
,我得到一個HTTP 404錯誤。在啓用SSL之前,我可以訪問該頁面。無法顯示通過HTTPS的WCF REST幫助頁
下面是我的web.config。有人可以幫助我瞭解如何通過HTTPS/SSL啓用WCF REST幫助頁面嗎?
<?xml version="1.0"?>
<configuration>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service name="MyNs.MyServiceWebserviceImpl" behaviorConfiguration="DefaultBehavior">
<endpoint name="MyServiceRestEndpoint" address="" binding="webHttpBinding" behaviorConfiguration="MyServiceRestBehavior" contract="MyNs.IMyServiceWebservice" />
<endpoint name="MyServiceSoapEndpoint" address="soap" binding="basicHttpBinding" bindingConfiguration="MyServiceSoapBinding" behaviorConfiguration="MyServiceSoapBehavior" contract="MyNs.IMyServiceWebservice" />
<endpoint name="MyServiceMexEndpoint" address="mex" binding="mexHttpsBinding" bindingConfiguration="" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultBehavior">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="MyServiceRestBehavior">
<webHttp helpEnabled="true" defaultOutgoingResponseFormat="Json" automaticFormatSelectionEnabled="true" />
</behavior>
<behavior name="MyServiceSoapBehavior" />
</endpointBehaviors>
</behaviors>
<bindings>
<webHttpBinding>
<binding name="MyServiceRestBinding">
<security mode="Transport" />
</binding>
</webHttpBinding>
<basicHttpBinding>
<binding name="MyServiceSoapBinding">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
</configuration>
我已啓用webHttp helpPage屬性。使用HTTPS,頁面不會呈現。它的結果是404。 – Martin
對不起,沒有注意到它急於回答:) Sooo,你有什麼應該工作。如果嘗試訪問HTTP幫助(端點仍然配置爲SSL),您會得到什麼嗎? –
由於IIS設置爲需要SSL,因此HTTP版本被阻止。如果我禁用它,頁面會回來。問題是我不想禁用SSL,我需要它。 – Martin