2012-06-04 63 views
0

我必須從我的WCF服務庫調用第三方web服務。當我從測試應用程序調用的第三方網絡服務,是沒有問題的,但是當我從我的WCF服務調用,有一個錯誤:從wcf服務調用第三方web服務

An error occurred while receiving the HTTP response to xxx.svc/ws. This could be...

我已經添加了第三方Web服務與Add Service Reference

我的WCF服務的
<wsHttpBinding> 
    <binding name="WSHttpBinding_xxxService" closeTimeout="00:01:00" 
      openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" 
      bypassProxyOnLocal="false" transactionFlow="false" 
      hostNameComparisonMode="StrongWildcard" 
      maxBufferPoolSize="524288" maxReceivedMessageSize="65536" 
      messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" 
      allowCookies="false"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
        maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> 
     <security mode="None"> 
      <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> 
      <message clientCredentialType="Windows" negotiateServiceCredential="true" /> 
     </security> 
    </binding> 
</wsHttpBinding> 

綁定是不同的:

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

綁定我的WCF服務的自動測試app.config文件生成,但綁定第三方爲Web服務綁定作爲自動生成服務僅在WCF應用程序配置中生成。

我在做什麼錯?

+0

您可以向我們展示您用來致電該第三方網絡服務的**代碼**嗎?你給我們展示的配置看起來很好 - 除了我們只看到綁定 - 沒有別的。您沒有向我們展示客戶端端點配置(URL,合同等) –

+0

在WCF服務和測試程序中我試圖用同樣的方式調用它:xxx_Ws.xxxClient client = new xxxClient(); client.Function(); – user1435135

+0

跟蹤無響應服務的活動可以讓我們瞭解爲什麼沒有響應。還要確保你沒有達到這些配額。 – insipid

回答

0

我找到了解決方案。問題在於,Web應用程序未使用在Web配置文件中配置的Web服務配置。它總是通過代理直接撥打電話。所以我從代碼中調用Web服務,並以編程方式輸入與Web服務的Web配置相同的設置,並添加代理地址,通過它可以通過我的網絡。

+0

恭喜修復!如果可以,請確保將您的答案標記爲「已接受」,以便其他人能夠從您的成功中學習。乾杯〜 –