【发布时间】:2009-03-13 18:44:48
【问题描述】:
尽管在我的 web.config 文件中设置了非常高的值,但我正在从网页调用我的 web 服务并获得超时。当文件通常非常大但但文件仍在完全上传(好像没有发生超时)时,这种情况会间歇性发生。这是我的 .aspx 文件中的一个函数,它调用我的 ASMX 代理类:
private void UploadFile(HttpPostedFile postedFile, string fileNameOnly)
{
// create an instance of the proxy class to talk to our service; calling it client:
string strURI = string.Empty;
WSproxyProject.ASMXProxy.FileService client = new WSproxyProject.ASMXProxy.FileService();
try
{
BinaryReader b = new BinaryReader(postedFile.InputStream);
byte[] binData = b.ReadBytes(numBytes);
strURI = client.UploadFile(binData, fileNameOnly, binData.Length);
txtURI.Text = strURI;
LogText("SUCCESS: " + fileNameOnly + " has been uploaded. URI=" + strURI);
}
catch (Exception ex)
{
LogText("UPLOAD ERROR: " + ex.Message.ToString());
}
}
请注意,我在 localhost 上的 Web 服务调用了另一个实际存储最终数据的 Web 服务。我在以下所有位置的 web.config 中都有以下 executionTimeout 设置:
- 我的 Web 客户端项目上的 web.config(myWebService 的调用者)
- myWebService 上的 web.config(vendorWebService 的调用者)
-
vendorWebService 上的 web.config(驻留在我 LAN 中的另一台服务器上)
上面的代码块捕获的异常显示 ex.Source 是 System.Web.Services 而 ex.Message 是:
操作已超时
【问题讨论】:
标签: asp.net web-services timeout