0
我想將我的WCF服務配置爲HTTPS。我已經配置了相關地址的行爲和服務,但我不明白爲什麼提供給服務主機的地址仍然是http。提供給ServiceHost的baseAddresses不是httpsps
我使用的行爲是在這裏:
<behavior name="RequestProcessorBehavior">
<serviceCredentials>
<userNameAuthentication
userNamePasswordValidationMode="Custom"
customUserNamePasswordValidatorType="ServiceAuthentication,Services"/>
</serviceCredentials>
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceThrottling maxConcurrentCalls="500" maxConcurrentInstances="500"/>
</behavior>
service元素在這裏
<service name="MyNamespace.WcfRequestProcessor" behaviorConfiguration="RequestProcessorBehavior">
<host>
<baseAddresses>
<add baseAddress="https://xxxxxxxxxxxxxx/Services/"/>
</baseAddresses>
</host>
<!--
Use the listenUri attribute if this causes a problem with the load balancer.
The url of the listenUri should be that of the load balancer
-->
<endpoint address=""
bindingNamespace="https://xxxxxxxxxxxxxx/Services/"
contract="MyNamespace.IWcfRequestProcessor"
binding="basicHttpBinding"
bindingConfiguration="RequestProcessorBinding">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="wsHttpBinding"
bindingNamespace="https://xxxxxxxxxxxxxx/Services/"
contract="MyNamespace.IWcfRequestProcessor"
binding="wsHttpBinding"
bindingConfiguration="wsBinding">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
當我添加斷點到的ServiceHost的構造函數中,我可以看到baseAddresses參數包含只有一個地址,那就是http而不是https。當我嘗試訪問svc頁面時,出現以下錯誤,我可以看到它爲什麼會顯示,但我看不到我可以更改的baseAddress,它將傳遞給ServiceHost構造函數https而不是http。
無法爲端點 具有約束力的basicHttpBinding的找到一個基地址 匹配方案HTTPS。 註冊的基地址方案是 [http]。
任何幫助將不勝感激。
更新#1
綁定配置部分,我離開了原來的問題:
<bindings>
<basicHttpBinding>
<binding name="RequestProcessorBinding" maxReceivedMessageSize="2147483647" receiveTimeout="00:30:00" sendTimeout="00:30:00">
<readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647"/>
<security mode="Transport">
<transport clientCredentialType="None"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
這是目前內部的開發環境和IIS6。這是在默認網站裏面。
我已更新問題以提供您所請求信息的缺失位 – 2010-07-23 13:00:53
看起來您的IIS配置不正確。您是否在IIS上啓用HTTPS並配置了服務器端證書? (請參閱http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/56bdf977-14f8-4867-9c51-34c346d48b04.mspx?mfr=true) – tomasr 2010-07-23 14:20:32
你是對的,它是IIS配置。謝謝你的時間。 :-) – 2010-07-23 15:35:47