The request was aborted: The request was canceled.
有没有人以前遇到过这个问题,你能分享一下解决方案吗?
一些信息:
>服务器正在使用ASP.NET 3.5.
>我上传时使用的http方法是“PUT”.
public class ExtendeDWebClIEnt : WebClIEnt{ public int Timeout { get; set; } public new bool AllowWriteStreamBuffering { get; set; } protected overrIDe WebRequest GetWebRequest(Uri address) { var request = base.GetWebRequest(address); if (request != null) { request.Timeout = Timeout; var httpRequest = request as httpWebRequest; if (httpRequest != null) { httpRequest.AllowWriteStreamBuffering = AllowWriteStreamBuffering; } } return request; } public ExtendeDWebClIEnt() { Timeout = 100000; // the standard http Request Timeout default }}
用法:
var webClIEnt = new ExtendeDWebClIEnt();webClIEnt.Timeout = Timeout.Infinite;webClIEnt.AllowWriteStreamBuffering = false;webClIEnt.Uploadfile(url,filePath);总结
以上是内存溢出为你收集整理的Web应用程序 – WebClient.UploadFile失败,“请求已中止:请求已取消.”全部内容,希望文章能够帮你解决Web应用程序 – WebClient.UploadFile失败,“请求已中止:请求已取消.”所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)