将FtpWebRequest的KeepAlive设置为true。

  1. return Return<Boolean>(
  2. new Uri(ftpPath + fileName),
  3. request =>
  4. {
  5. request.Credentials = credentials;
  6. request.Method = WebRequestMethods.Ftp.UploadFile;
  7. request.KeepAlive = true;
  8. request.UseBinary = true;
  9.  
  10. using (var requestStream = request.GetRequestStream())
  11. {
  12. var bufferSize = ;
  13. var read = ;
  14. var buffer = new Byte[bufferSize];
  15.  
  16. while ((read = stream.Read(buffer, , bufferSize)) > )
  17. requestStream.Write(buffer, , read);
  18. }
  19. },
  20. 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. linux mount 挂接新硬盘

    1.先用fdisk -l查看一下,先加入的外设地址名称   2. #fdisk /dev/sdb进入fdisk模式:Command (m for help):p //查看新硬盘的分区Command ( ...

  2. vi编辑器的使用方式

    vi编辑器是所有Unix及Linux系统下标准的编辑器,它的强大不逊色于任何最新的文本编辑器,这里只是简单地介绍一下它的用法和一小部分指令.由于对Unix及Linux系统的任何版本,vi编辑器是完全相 ...

  3. 安卓开发笔记——TabHost组件(二)(实现底部菜单导航)

    上面文章<安卓开发复习笔记——TabHost组件(一)(实现底部菜单导航)>中提到了利用自定义View(ImageView+TextView)来设置一个底部菜单的样式 这边再补充一种更为灵 ...

  4. Spring依赖注入原理分析

    在分析原理之前我们先回顾下依赖注入的概念: 我们常提起的依赖注入(Dependency Injection)和控制反转(Inversion of Control)是同一个概念.具体含义是:当某个角色( ...

  5. Vim终极指南:所思即所得

    https://blog.csdn.net/dc_726/article/details/78981756

  6. Linux┊理解devfs、sysfs、udev、tmpfs等各种文件系统

    https://www.cnblogs.com/yangliheng/p/6187193.html https://blog.csdn.net/qq258711519/article/details/ ...

  7. 安装kafka集群

    1解压tar包 tar -zxvf kafka_2.-.tgz 2.进入config目录 3.配置server.properties文件 # Licensed to the Apache Softwa ...

  8. Ulua_toLua_基本案例(六)_LuaCoroutine2

    Ulua_toLua_基本案例(六)_LuaCoroutine2 using UnityEngine; using System.Collections; using LuaInterface; pu ...

  9. Splash runjs() 方法

    runjs() 方法可以执行 JavaScript 代码,它与 evaljs() 功能类似,但是更偏向于执行某些动作或声明某些方法 function main(splash, args) splash ...

  10. python --->字典 集合 学习笔记

    1.字典--->创建空字典:dict={} broa=["李宁",”耐克“,“阿迪达斯”,“鱼c工作室”] sloga=[“A”,“B”,“C”,“D”] dict={&qu ...