我一直在我可能找到的任何地方(包括這裏在Stackoverflow)上搜索,以找出一個錯誤,我試圖將WCF服務部署到Windows 7 x64上的IIS 7.5上,該服務僅通過帶有基本HTTP身份驗證的SSL運行。我在IIS中有一個站點,它具有綁定到端口50443的HTTPS和自簽名證書。 (我不能使用標準端口443,因爲我們計劃在已經運行Tomcat這是在80和443監聽服務器上部署這IIS)HTTPS上的WCF生成「提供的URI方案'https'無效;期望'http'。」
這是在web.config:
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="SSLBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Basic"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="HelloWorldWcf.HelloWorldWcfService">
<endpoint name="HelloWorldWcf.HelloWorldWcfService"
address="https://mylaptop:50443/HelloWorld/Service1.svc"
binding="basicHttpBinding"
bindingConfiguration="SSLBinding"
contract="HelloWorldWcf.IHelloWorldWcfService"/>
<endpoint address="https://mylaptop:50443/HelloWorld/Service1.svc/mex"
binding="mexHttpsBinding"
contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
如果我手動瀏覽到服務端點地址並輸入基本身份驗證憑據,我得到了我的瀏覽器中顯示以下異常錯誤信息:
The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: context.ListenUriBaseAddress
這是我得到嘗試運行同樣的錯誤WCF客戶端針對類似的服務,除了它以「Parameter name:via」結尾(因爲調用堆棧中顯示的方法的參數名稱「System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(URI via)」實際上是「via」)。
我已經調整了服務器和客戶端配置文件很多次,我失去了軌道,但上面的web.config文件是我迄今爲止最好的猜測 - 它甚至不能從瀏覽器工作,很多少一個WCF客戶端。
通過基於HTTPS的HTTP身份驗證,在非標準SSL端口上訪問託管在IIS 7.5中的WCF服務需要做什麼?幫幫我! (&謝謝!)
每當我嘗試使用mode =「Transport」時,出現此錯誤:「此服務的安全設置需要'匿名'身份驗證,但未啓用承載此服務的IIS應用程序。」你知道它指的是什麼「安全設置」嗎?如果我改變你的建議,以便除了回到mode =「TransportCredentialOnly」之外,所有內容都是相同的,我會得到最初報告的錯誤。謝謝! – ALEXintlsos 2012-07-17 14:53:18