FTPWebRequest BeginGetRequestStream从不触发回调,GetRequestStream操作超时 [英] FTPWebRequest BeginGetRequestStream never fires callback, GetRequestStream operation timed out

查看:126
本文介绍了FTPWebRequest BeginGetRequestStream从不触发回调,GetRequestStream操作超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,

我正在使用FTPWebRequest来异步上传文件。当我使用BeginGetRequestStream方法时,我的回调永远不会执行。为了调试,我简化并调用了GetRequestStream,并且每当我得到"操作超时"时。我正在使用EnableSSL = true。这是使用异步模式的跟踪输出的尾部。无论我等待多久,它都不会超过这一点。

System.Net信息:0:[4368] FtpControlStream#59321765 - 收到响应[200 PORT命令成功] System.Net Information :0:[4368] FtpControlStream#59321765 - 发送命令[STOR test.txt]
System.Net.Sockets详细:0:[4368]套接字#37710717 :: BeginSend()
System.Net.Sockets详细:0:[4368]退出套接字#37710717 :: BeginSend() - > OverlappedAsyncResult#20115393
System.Net.Sockets详细:0:[4368]来自Socket的数据#37710717 :: PostCompletion
System.Net.Sockets详细:0:[4368] 00000000:17 03 01 00 1F A9 5D 78-60 EE 2D D0 E7 8A 3B 61:......] x` .- ...; a
System.Net.Sockets详细:0:[4368] 00000010:22 14 1D 12 59 2F 2A 40-5D 92 AE 72 7F 49 D5 C3:" ... Y / * @] .. rI 。 。
System.Net.Sockets详细:0:[4368] 00000020:A5 97 3F 15:..?。
System.Net.Sockets详细:0:[4368]套接字#37710717 :: EndSend(OverlappedAsyncResult #20115393)
System.Net.Sockets详细:0:[4368]退出套接字#37710717 :: EndSend() - > 36#36
System.Net.Sockets详细:0:[4368]套接字#37710717 :: BeginReceive()
System.Net.Sockets详细:0:[4368]退出套接字#37710717 :: BeginReceive() - > OverlappedAsyncResult#5726763
System.Net.Sockets详细:0:[4368]来自Socket的数据#37710717 :: PostCompletion
System.Net.Sockets详细:0:[4368] 00000000:17 03 01 00 2A :. ... *
System.Net.Sockets详细:0:[4368]套接字#37710717 :: EndReceive(OverlappedAsyncResult#5726763)
System.Net.Sockets详细:0:[4368]退出套接字#37710717: :EndReceive() - > 5#5
System.Net.Sockets详细:0:[4368]套接字#37710717 :: BeginReceive()
System.Net.Sockets详细:0:[4368]退出套接字#37710717 :: BeginReceive() - > OverlappedAsyncResult#57990079
System.Net.Sockets详细:0:[4368]来自套接字的数据#37710717 :: PostCompletion
System.Net.Sockets详细:0:[4368] 00000000:A0 78 BB E0 82 F9 B5 3C-3A CA E2 6C B6 75 09 30:.x .....<:.. lu0
System.Net.Sockets详细:0:[4368] 00000010:0B 41 1D E5 05 60 5E 6F -F6 73 D9 BA 54 E4 2B 4F:.A ...`^ os.T. + O
System.Net.Sockets详细:0:[4368] 00000020:4E 0E A4 26 9A 17 A2 19-09 21:N ..& .....!
System.Net.Sockets详细:0:[4368]套接字#37710717 :: EndReceive(OverlappedAsyncResult#57990079)
System.Net.Sockets详细:0 :[4368]退出套接字#37710717 :: EndReceive() - > 42#42
System.Net信息:0:[4368] FtpControlStream#59321765 - 收到响应[150 STOR命令已启动]
System.Net.Sockets详细:0:[4368]套接字#25897445 :: BeginAccept( )
System.Net.Sockets详细:0:[4368]套接字#17100198 ::套接字(InterNetwork#2)
System.Net.Sockets详细:0:[4368]退出套接字#17100198 ::套接字( )
System.Net.Sockets详细:0:[4368]退出套接字#25897445 :: BeginAccept() - > AcceptOverlappedAsyncResult#35187200


 
    I am using FTPWebRequest to asynchronously upload a file.  When I use the BeginGetRequestStream method, my callback is never executed.  To debug, I simplified and just called GetRequestStream, and every time I got "operation timed out."  I am using EnableSSL=true.  Here is the tail of my trace output using the asynchrous pattern.  No matter how long I wait, it never progresses past this point.

System.Net Information: 0 : [4368] FtpControlStream#59321765 - Received response [200 PORT command successful]System.Net Information: 0 : [4368] FtpControlStream#59321765 - Sending command [STOR test.txt]
System.Net.Sockets Verbose: 0 : [4368] Socket#37710717::BeginSend()
System.Net.Sockets Verbose: 0 : [4368] Exiting Socket#37710717::BeginSend()  -> OverlappedAsyncResult#20115393
System.Net.Sockets Verbose: 0 : [4368] Data from Socket#37710717::PostCompletion
System.Net.Sockets Verbose: 0 : [4368] 00000000 : 17 03 01 00 1F A9 5D 78-60 EE 2D D0 E7 8A 3B 61 : ......]x`.-...;a
System.Net.Sockets Verbose: 0 : [4368] 00000010 : 22 14 1D 12 59 2F 2A 40-5D 92 AE 72 7F 49 D5 C3 : "...Y/*@]..r.I..
System.Net.Sockets Verbose: 0 : [4368] 00000020 : A5 97 3F 15                                     : ..?.
System.Net.Sockets Verbose: 0 : [4368] Socket#37710717::EndSend(OverlappedAsyncResult#20115393)
System.Net.Sockets Verbose: 0 : [4368] Exiting Socket#37710717::EndSend()  -> 36#36
System.Net.Sockets Verbose: 0 : [4368] Socket#37710717::BeginReceive()
System.Net.Sockets Verbose: 0 : [4368] Exiting Socket#37710717::BeginReceive()  -> OverlappedAsyncResult#5726763
System.Net.Sockets Verbose: 0 : [4368] Data from Socket#37710717::PostCompletion
System.Net.Sockets Verbose: 0 : [4368] 00000000 : 17 03 01 00 2A                                  : ....*
System.Net.Sockets Verbose: 0 : [4368] Socket#37710717::EndReceive(OverlappedAsyncResult#5726763)
System.Net.Sockets Verbose: 0 : [4368] Exiting Socket#37710717::EndReceive()  -> 5#5
System.Net.Sockets Verbose: 0 : [4368] Socket#37710717::BeginReceive()
System.Net.Sockets Verbose: 0 : [4368] Exiting Socket#37710717::BeginReceive()  -> OverlappedAsyncResult#57990079
System.Net.Sockets Verbose: 0 : [4368] Data from Socket#37710717::PostCompletion
System.Net.Sockets Verbose: 0 : [4368] 00000000 : A0 78 BB E0 82 F9 B5 3C-3A CA E2 6C B6 75 09 30 : .x.....<:..l.u.0
System.Net.Sockets Verbose: 0 : [4368] 00000010 : 0B 41 1D E5 05 60 5E 6F-F6 73 D9 BA 54 E4 2B 4F : .A...`^o.s..T.+O
System.Net.Sockets Verbose: 0 : [4368] 00000020 : 4E 0E A4 26 9A 17 A2 19-09 21                   : N..&.....!
System.Net.Sockets Verbose: 0 : [4368] Socket#37710717::EndReceive(OverlappedAsyncResult#57990079)
System.Net.Sockets Verbose: 0 : [4368] Exiting Socket#37710717::EndReceive()  -> 42#42
System.Net Information: 0 : [4368] FtpControlStream#59321765 - Received response [150 STOR command started]
System.Net.Sockets Verbose: 0 : [4368] Socket#25897445::BeginAccept()
System.Net.Sockets Verbose: 0 : [4368] Socket#17100198::Socket(InterNetwork#2)
System.Net.Sockets Verbose: 0 : [4368] Exiting Socket#17100198::Socket()
System.Net.Sockets Verbose: 0 : [4368] Exiting Socket#25897445::BeginAccept()  -> AcceptOverlappedAsyncResult#35187200

推荐答案

做你有防火墙阻止传入连接尝试?尝试将FTPWebRequest配置为使用被动模式。
do you have a firewall that blocks incoming connection attempts ? try configuring FTPWebRequest to use passive mode instead.


这篇关于FTPWebRequest BeginGetRequestStream从不触发回调,GetRequestStream操作超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆