我有一个静态类,它返回 webclient 的新实例
public static class WebAccess
{
public static WebClient GetWebClient()
{
return new WebClient();
}
}
然后我用这个类来点击这样的页面
WebAccess.GetWebClient().DownloadString(new Uri("http://" + WLCDomainUrl + ConfigurationManager.AppSettings["urlClearCache"].ToString() + "/?id=" + Request.QueryString["id"] + "&Type=RC"));
我不想赶上回应
但它大部分时间都在抛出异常
WebClient does not support concurrent I/O operations.
Stack Trace:
at System.Net.WebClient.ClearWebClientState()
at System.Net.WebClient.DownloadString(Uri address)
at UpdateCache.ProcessLocationCacheRequest(String locId, Boolean isChain) in
WebClient does not support concurrent I/O operations.
Stack Trace:
at System.Net.WebClient.ClearWebClientState()
at System.Net.WebClient.UploadString(Uri address, String method, String data)
at System.Net.WebClient.UploadString(String address, String data)
at CacheClassLibrary.ServerClass.APIServer.Create(String Id, String MobileWLCUrl) in
有什么帮助吗??我无法理解它,因为我正在使用新的 Web 客户端实例为每个请求提供服务:/
应用程序同时收到多个请求。