問題:C#調webservice超時;結果:C#調用webservice服務超時


C#調用WebService服務時,報錯,The operation has timed out,意思是“操作超時”。

C#調用webservice服務超時

方法/步驟

  1. 首先修改服務端配置

    WebService服務所在站點為服務端,它提供了服務,打開這個站點的web.config,添加下面的配置:

     

        <httpRuntime  executionTimeout="300000" />

    <compilation defaultLanguage="c#" debug="false">

     

    executionTimeout="300000" 單位是“毫秒”,這里配置的是5分鍾。

    debug="false" 要關閉調試。

     

    如果web.config中本來就有這兩個配置,修改一下就行了。如果沒有,就添加上去,完整的結構順序如下:

    <configuration>

      <system.web> 

            <httpRuntime  executionTimeout="300000" />

            <compilation defaultLanguage="c#" debug="false">

          </compilation>

      </system.web>

    </configuration>

  2. 2

     修改調用程序客戶端的配置

    YourService. YourService model = new YourService. YourService ();

    model.Timeout = 300000; // 單位是毫秒,設置時間,否則時間超限

     

    這里給服務對象model設置超時時間Timeout為300000毫秒。

     


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM