最近使用多线程同时调用一个Web Service,总是有很多调用报超时,代码类似于下面的代码(为了简化,我把调用Web Service改为使用HttpWebRequest访问一个网址,效果时一样的):

我循环调用100次,但是总是有几十次调用报超时,具体如下:

System.Net.WebException: 操作已超时。
   at System.Net.HttpWebRequest.GetResponse()
   at HttpRequestTest.HttpRequestTest.MakeWebRequest(Object obj) in g:\my documents\visual studio projects\httprequesttest\httprequesttest.cs:line 35

真的不知道为什么,难道Web Service就不能在多线程的环境下调用!

因为目前找不到原因,暂时放在首页,想向各位请教,明天就撤调,请手下留情,谢谢!


 1在多线程环境下使用HttpWebRequest或者调用Web Serviceusing System;
 2在多线程环境下使用HttpWebRequest或者调用Web Serviceusing System.Diagnostics;
 3在多线程环境下使用HttpWebRequest或者调用Web Serviceusing System.Net;
 4在多线程环境下使用HttpWebRequest或者调用Web Serviceusing System.Threading;
 5在多线程环境下使用HttpWebRequest或者调用Web Service
 6在多线程环境下使用HttpWebRequest或者调用Web Servicenamespace HttpRequestTest
 7


相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-30
  • 2022-12-23
  • 2021-06-21
  • 2021-09-26
  • 2021-11-01
猜你喜欢
  • 2021-05-21
  • 2022-03-06
  • 2021-11-08
  • 2022-12-23
相关资源
相似解决方案