将FtpWebRequest的KeepAlive设置为true。

return Return<Boolean>(
new Uri(ftpPath + fileName),
request =>
{
request.Credentials = credentials;
request.Method = WebRequestMethods.Ftp.UploadFile;
request.KeepAlive = true;
request.UseBinary = true; using (var requestStream = request.GetRequestStream())
{
var bufferSize = ;
var read = ;
var buffer = new Byte[bufferSize]; while ((read = stream.Read(buffer, , bufferSize)) > )
requestStream.Write(buffer, , read);
}
},
respone => true);

FtpWebRequest UploadFile返回"The underlying connection was closed: The server committed a protocol violation."解决方法的更多相关文章

  1. [WebException: The underlying connection was closed: The message length limit was exceeded.]解决方法

    [WebException: The underlying connection was closed: The message length limit was exceeded.]   Syste ...

  2. windows xp .net framework 4.0 HttpWebRequest 报The underlying connection was closed,基础连接已关闭

    windows xp .net framework 4.0 HttpWebRequest 报The underlying connection was closed,基础连接已关闭,错误的解决方法 在 ...

  3. C#使用FtpWebRequest 基础连接已经关闭:连接被意外关闭(The underlying connection was closed:The connection was closed unexpectedly)

    公司内部开发的winform程序使用了FtpWebRequest下载FTP服务器的文件到本地. 大多数人运行良好,由于我们是试运行逐步有人加入到平台的使用,前两天突然有个别机器无法连接FTP服务器报出 ...

  4. EX:The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

    EX:The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secu ...

  5. Web Server 使用WebClient 发送https请求 The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel

    使用WebClient 发送https请求 使用WebClient发送请求时,并且是以https协议: WebClient webClient = new WebClient(); string re ...

  6. 微信接口问题(The underlying connection was closed: An unexpected error occurred on a send)

    突然在调用微信接口是报:The underlying connection was closed: An unexpected error occurred on a send错误,跟踪了半天,是因为 ...

  7. [bug]The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.

    写在前面 在模拟请求的时候,如果url为https的,会报这个错误.大概错误就是:基础连接已关闭:无法建立信任关系的SSL / TLS的安全通道. The underlying connection ...

  8. The underlying connection was closed: An unexpected error occurred on a send

    操作系统是Windows Server 2003 x64 SP2,使用Framework 4.0,在使用WebClient访问某些特定的HTTPS站点时,会引发异常: Unhandled Except ...

  9. ORACLE用SYS登录报ORA-28009:connection as SYS should be as SYSDBA OR SYSOPER解决方法

    情况一:使用sqlplus登录 正常输入用户名的口令,就会报错,因为SYS是在数据库之外的超级管理员,所以我们在登录的时候 要在输入口令:口令+as sysdba(比如:123456 as sysdb ...

随机推荐

  1. 基于struts2的ajaxfileupload异步上传插件的使用

    服务器端采用struts2来处理文件上传. 所需环境: jquery.js ajaxfileupload.js struts2所依赖的jar包 及struts2-json-plugin-2.1.8.1 ...

  2. hive 配置元数据以mysql 存储

    <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="confi ...

  3. 腾讯QQ积分CSRF导致积分任意挥霍(我的积分为什么少了)

    触发点:http://jifen.qq.com/html5/index.html?ADTAG=JIFEN.MART.INDEX 随意兑换一个商品: 因为刚才我已经兑换过了,所以积分没有了.. 没关系, ...

  4. 【WP8】富文本功能实现

    2014年8月1日更新:修复如果有多个相同链接解析失败的Bug,谢谢 @Walsh 提供的问题 富文本在移动APP上应用的最多的就是表情了,类似微博,QQ,微信都有对提供对表情和链接的支持,富文本一般 ...

  5. Unity3D编辑器之不实例化Prefab获取删除更新组件

    原文链接:http://www.xuanyusong.com/archives/3727

  6. Android ScrollView 和ListView 一起使用的问题汇总

    1.ScrollView 嵌套 ListView  ,touch事件的截获问题. 参考 http://www.cnblogs.com/lqminn/archive/2013/03/02/2940194 ...

  7. 一个标准的,兼容性很好的div仿框架的基础模型!

    <!DOCTYPE html> <html > <head> <meta http-equiv="Content-Type" conten ...

  8. C# toolstrip 上添加DateTimePicker Control控件

    private void AddDTPtoToolstrip( n){DateTimePicker dtp = DateTimePicker;dtp.Width = 110;dtp.Format = ...

  9. scrapy 元素的相对xpath

  10. c++静态全局,局部变量---18

    原创博文,转载请标明出处--周学伟  http://www.cnblogs.com/zxouxuewei/ static有两种用法:面向过程程序设计中的static和面向对象程序设计中的static. ...