FtpWebRequest UploadFile返回"The underlying connection was closed: The server committed a protocol violation."解决方法
将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."解决方法的更多相关文章
- [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 ...
- windows xp .net framework 4.0 HttpWebRequest 报The underlying connection was closed,基础连接已关闭
windows xp .net framework 4.0 HttpWebRequest 报The underlying connection was closed,基础连接已关闭,错误的解决方法 在 ...
- C#使用FtpWebRequest 基础连接已经关闭:连接被意外关闭(The underlying connection was closed:The connection was closed unexpectedly)
公司内部开发的winform程序使用了FtpWebRequest下载FTP服务器的文件到本地. 大多数人运行良好,由于我们是试运行逐步有人加入到平台的使用,前两天突然有个别机器无法连接FTP服务器报出 ...
- 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 ...
- 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 ...
- 微信接口问题(The underlying connection was closed: An unexpected error occurred on a send)
突然在调用微信接口是报:The underlying connection was closed: An unexpected error occurred on a send错误,跟踪了半天,是因为 ...
- [bug]The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
写在前面 在模拟请求的时候,如果url为https的,会报这个错误.大概错误就是:基础连接已关闭:无法建立信任关系的SSL / TLS的安全通道. The underlying connection ...
- The underlying connection was closed: An unexpected error occurred on a send
操作系统是Windows Server 2003 x64 SP2,使用Framework 4.0,在使用WebClient访问某些特定的HTTPS站点时,会引发异常: Unhandled Except ...
- ORACLE用SYS登录报ORA-28009:connection as SYS should be as SYSDBA OR SYSOPER解决方法
情况一:使用sqlplus登录 正常输入用户名的口令,就会报错,因为SYS是在数据库之外的超级管理员,所以我们在登录的时候 要在输入口令:口令+as sysdba(比如:123456 as sysdb ...
随机推荐
- 局域网 ping
时间:2013-01-15 11:07来源:网络整理 作者:秩名点击:2271次 |我要投稿 一般情况下,如果我们使用Ping命令来查找网络问题所在或检验网络运行情况,我们需要使用许多Ping命令,如 ...
- .NET条形码
建议不要用CODE-39码,改用CODE-128码: CODE-39码密度比较低,条码数字内容太多,导致条码太长,缩短长度就只能减小X尺寸,造成识读困难: CODE-128码密度高,相同的数字生成条码 ...
- Activity 经历如下3个阶段
Activity 经历如下3个阶段 开始Activity: 在这个阶段依次执行3个生命周期的方法,分别是onCreate onStart onResume 三个方法. Activity重新获取焦点:o ...
- Blender 建模
1.多图层切换 Blender也有图层的概念,我们在一个图层上建立了一个模型,可以在另外一个图层新建一个独立的模型.界面底部包含了Layer切换按钮.如下图所示: 当前我们正在操作第一个图层,如果想在 ...
- springmvc 文件下载
1.使用servlet的API实现 参考:http://my.oschina.net/u/1394615/blog/311307 @RequestMapping("/download&quo ...
- Android数据库升级、降级、创建(onCreate() onUpgrade() onDowngrade())的注意点
以下内容可以作为面试官在面试的时候的问题,感觉比较好,是比较常用的知识点,可以用来考察基础是否扎实. 也可以程序猿学习.开发中的注意点.因为稍微不注意,就有可能导致数据库不能用. DBAdapter. ...
- Dubbo -- 系统学习 笔记 -- 示例 -- 集群容错
Dubbo -- 系统学习 笔记 -- 目录 示例 想完整的运行起来,请参见:快速启动,这里只列出各种场景的配置方式 集群容错 在集群调用失败时,Dubbo提供了多种容错方案,缺省为failover重 ...
- mongodb 初学 索引
连接服务器异常(Connection refused) 啦啦啦 mongodb 搭建主从服务器 啦啦啦 Mongodb启动命令mongod参数说明 啦啦啦 MongoDB 分片 啦啦啦 啦啦啦 啦啦啦 ...
- swift开发之--代理协议的使用
swift代理的使用,和oc版本有区别,区别还是蛮大的,不过和oc一样都是用于反向传值: 实现如下: 1,声明两个类 2,实现流程,viewcontroller页面点击按钮进入firstVC页面,然后 ...
- 文件完整性hash验证demo(python脚本)
一个简单的文件完整性hash验证脚本 #!/usr/bin/env python # -*- coding: utf- -*- import os import hashlib import json ...