2011-02-01 49 views
18

我已將WCF服務配置爲使用SSL,但只有在IIS網站中存在HTTP綁定時纔可使用。當HTTP綁定不存在並且僅存在HTTPS綁定時,出現以下錯誤:如何配置WCF服務通過HTTPS而不使用HTTP綁定?

The HttpGetEnabled property of ServiceMetadataBehavior is set to true and the HttpGetUrl property is a relative address, but there is no http base address. Either supply an http base address or set HttpGetUrl to an absolute address.

如何解決此問題?

謝謝。

+0

你能解釋一下這究竟意味着「它的工作原理只有在HTTP綁定存在」?謝謝...我在我的WCF面臨同樣的問題.. WCf工作正常一臺服務器,但沒有在其他.. :( – Lamps 2011-11-21 07:16:38

回答

44

的mexHTTPSBinding unstead修改你的配置是這樣的:

<behaviors> 
    <serviceBehaviors> 
    <behavior> <!-- behavior can have name (must have name in WCF 3.x) --> 
     <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" /> 
    </behavior> 
    </serviceBehaviors> 
</behaviors> 
+1

我面臨同樣的問題..但它只發生在少數服務器..服務託管一臺服務器工作正常,其他服務器拋出錯誤中提到的錯誤..任何想法? 謝謝。 – Lamps 2011-11-21 07:24:11

4

你需要使用mexHTTPBinding

<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" /> 
+0

這不是原因的OP的問題,但是如果你定義元數據端點因爲它需要通過`https`可用 – Darbio 2012-10-11 06:38:01