【发布时间】:2017-07-12 03:07:42
【问题描述】:
我的网站中有 4 个文件上传控件,每个控件都将使用 (HttpWebResponse)Request.GetResponse() 访问我的文件服务器,第一个上传速度很快,但第二个上传速度很快很慢,但第三和第四上传也很快。所有的文件都是一样的。我使用(System.Net.HttpWebResponse)Request.GetResponse(); 是因为我想访问/获取响应该服务器中的文件夹。
我检查了我的日志,结果发现 all 上传返回错误The remote server returned an error: (405) Method Not Allowed. 那么为什么在 second 上传速度较慢,花了 20 秒才得到响应,但请求的其余部分就像一秒钟。
这是我的原始代码:
try
{
Response = (System.Net.HttpWebResponse)Request.GetResponse();
Response.Close();
}
catch (Exception)
{
我已经尝试将我的 Request.Proxy 设置为 null 以及
using (Response = (HttpWebResponse)Request.GetResponse())
{
}
还有
<system.net>
<connectionManagement>
<add address="*" maxconnection="20"/>
</connectionManagement>
</system.net>
还有
httpWebRequest.Abort();
所以事实证明(System.Net.HttpWebResponse)Request.GetResponse(); 返回一个错误。如何关闭它?
【问题讨论】:
-
请求 2,3 和 4 得到 405 吗?
-
是的,我收到所有请求的 405 错误。
标签: c# fileserver