简体   繁体   English

当我们在代理后面时,无法使用StreamSocket连接IMAP服务器

[英]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.

相关问题 当我在Window Server 2012中调用Web服务(使用代理)时无法连接到远程服务器 - Unable to connect to remote server when i call my webservice (using proxy) in Window server 2012 无法调用 traefik 反向代理后托管的 grpc 服务器 - Unable to call grpc server hosted behind traefik reverse proxy 使用HttpWebRequest.GetRequestStream时无法连接到远程服务器 - unable to connect to remote server when using HttpWebRequest.GetRequestStream 对我的网站使用基本身份验证时无法连接到服务器 - Unable to connect to the server when using Basic Authentication for my website 以编程方式使用免费代理服务器连接到网站 - connect to website using a free proxy server programmatically 无法使用服务器资源管理器进行连接 - Unable To Connect using Server Explorer 使用Wait()时,StreamSocket.InputStreamOptions.ReadAsync挂起 - StreamSocket.InputStreamOptions.ReadAsync hangs when using Wait() 在Wpf和WinForms上使用StreamSocket - Using StreamSocket on Wpf and WinForms 使用StreamSocket升级到SSL - Upgrade to SSL using StreamSocket 如何在C#中连接到IMAP服务器? - How connect to IMAP server in C#?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM