2013-03-25 1109 views
2

我有一個服務調用導致以下錯誤:「提供的URI方案'http'無效;預期'https'。」Web服務錯誤「提供的URI方案'http'無效;期望'https'。」

的app.config值:

<basicHttpBinding> 
<binding name="xx_xxxxx_spcName" closeTimeout="00:01:00" 
       openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
       allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
       maxBufferSize="655360" maxBufferPoolSize="524288" maxReceivedMessageSize="655360" 
       messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
       useDefaultWebProxy="true"> 
      <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
       maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
      <security mode="Transport"> 
      <transport clientCredentialType="None" /> 
      </security> 
     </binding> 
</basicHttpBinding> 


<client> 
<endpoint address="http://server/serviceaddress_removed" 
       binding="basicHttpBinding" bindingConfiguration="xx_xxxxx_spcName" 
       contract="xx.xx_xxxxx_spcName" name="xx_xxxxx_spcName" /> 
</client> 

我用盡https://開頭,但逝去的內部所以不希望我需要這個,再說這也給一個客戶機/服務器錯誤。

我也試圖改變綁定類型

我也通過其他論壇的帖子看着這裏和asp.net和似乎都在用運輸和傳遞客戶端憑證點,我正在做在我的代碼如下:

client.ClientCredentials.UserName.UserName = "XXXXX"; 
client.ClientCredentials.UserName.Password = "XXXXX"; 
+0

當IIS配置爲需要SSL時,我遇到了類似的問題。 – 2013-10-10 21:54:11

回答

6

您必須將<security mode="Transport">更改爲無。運輸部隊https。

0

如果我還記得我的WCF配置培訓,Transport安全專門意味着您正在使用HTTPS。如果您未使用HTTPS,則應將您的安全類型設置爲「無」,並知道您的郵件將被解密。

我相信你也可以使用「消息」並手動提供證書,但我以前沒有這樣做過。

+0

我試過Message並將消息credentialType設置爲Username,但是我得到這個錯誤:BasicHttp綁定要求BasicHttpBinding.Security.Message.ClientCredentialType等效於BasicHttpMessageCredentialType.Certificate證書類型的安全消息。爲UserName憑證選擇Transport或TransportWithMessageCredential安全性。 – Andy 2013-03-25 15:07:21

相關問題