[英]Unable to connect IMAP server using StreamSocket when we are behind the Proxy
I'm writing a simple C# Store app to check email messages for IMAP. 我正在编写一个简单的C#Store应用程序以检查IMAP电子邮件。 I'm using StreamSocket to connect IMAP server.
我正在使用StreamSocket连接IMAP服务器。 But the problem is, when we are behind the proxy we are unable to connect to IMAP server and getting below error message.
但是问题是,当我们在代理后面时,我们将无法连接到IMAP服务器并出现以下错误消息。
"A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (Exception from HRESULT: 0x8007274C)".
“连接尝试失败,因为连接的一方在一段时间后未正确响应,或者建立的连接失败,因为连接的主机未能响应。(来自HRESULT的异常:0x8007274C)”。
I have added the code snippet for the reference. 我已经添加了代码片段作为参考。
StreamSocket Socket = new StreamSocket();
await Socket.ConnectAsync(new HostName("imap.gmail.com"), "993", SocketProtectionLevel.SslAllowNullEncryption);
But the same code is working fine when there is no proxy. 但是,当没有代理时,相同的代码也可以正常工作。
Could you please help regarding this problem? 您能帮忙解决这个问题吗?
My Development Environment is C# using VS2013 with Windows 8.1 Operating System. 我的开发环境是使用VS2013和Windows 8.1操作系统的C#。
Thanks in advance. 提前致谢。
The proxy you refer to is probably a web proxy only and all access to the outside is only allowed through this proxy. 您引用的代理可能仅是Web代理,并且仅允许通过此代理进行对外部的所有访问。 This means, that only web traffic (eg http, https and proxied ftp) can pass, but not other procols like IMAP, SMTP (mail sending) etc - because these cannot be tunneled through a HTTP proxy.
这意味着,只有网络流量(例如http,https和代理的ftp)可以通过,而其他协议(如IMAP,SMTP(邮件发送)等)则不能通过-因为这些不能通过HTTP代理进行隧道传输。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.