【发布时间】:2012-09-14 13:41:51
【问题描述】:
我的 Windows Azure 项目 (c#) 中有一个奇怪的问题
我的 C# Azure 应用使用 Exchange 托管 API 与 Web 上的 Exchange 2010 服务器进行通信。
Exchange 2010 本身在 Azure VM 中运行。我已经打开了防火墙,以便 Exchange EWS 网络服务在端口 443 上可用。
在 Azure 模拟器中本地运行时,我的应用程序运行良好。我可以看到我帐户中的所有文件夹和电子邮件。它可以通过 Web 与 Exchange VM 完美通信。
但是,一旦我将应用发布到暂存环境,该应用就无法正常运行。
对服务器的第一次调用有效,但之后,我收到此消息:
“连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立连接失败,因为连接的主机没有响应 [IPADDRESS]:443”
正如我所说,它第一次可以工作(我的索引页面出现了我需要的内容)但是如果我刷新那个页面,它就会给我那个错误。
因此,我认为这不是防火墙问题,否则第一次无法正常工作。
这让我感到绝望——我看不出有什么问题!
希望你能帮忙,
西蒙。
[编辑] 这是堆栈跟踪:
[SocketException (0x274c): 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]
System.Net.Sockets.NetworkStream.EndRead(IAsyncResult asyncResult) +136
[IOException: Unable to read data from the transport connection: 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.]
System.Net.Security._SslStream.EndRead(IAsyncResult asyncResult) +7911429
System.Net.TlsStream.EndRead(IAsyncResult asyncResult) +2691856
System.Net.Connection.ReadCallback(IAsyncResult asyncResult) +79
[WebException: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.]
System.Net.HttpWebRequest.GetResponse() +7864676
Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(HttpWebRequest request) +130
[ServiceRequestException: The request failed. The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.]
Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(HttpWebRequest request) +447
Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(HttpWebRequest& request) +647
Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest`1.Execute() +72
Microsoft.Exchange.WebServices.Data.ExchangeService.BindToFolder(FolderId folderId, PropertySet propertySet) +201
Microsoft.Exchange.WebServices.Data.CalendarFolder.Bind(ExchangeService service, WellKnownFolderName name) +83
【问题讨论】:
-
值得指出的是,Exchange 运行良好,Outlook Web Access 还可以,我的本地模拟器版本仍然可以运行,Outlook 桌面版也可以。
-
好吧,更奇怪了。如果我 VIP 交换生产和登台,应用程序突然开始在生产模式下运行而没有任何问题。生产应用程序现在无法正常暂存。但我很相信防火墙不是问题。我还重新启动了 Exchange 服务器,但它仍然无法在暂存中工作。有什么想法吗?
-
可能是您的应用程序遇到了暂时性故障(与 Exchange VM 的临时连接丢失)?如果您切换回 staging 会发生什么,它会再次中断吗?
-
您好 Sandrino,感谢您的留言。如果我把它换回来,它又会坏掉!没有任何迹象表明连接出现故障,因为我所有其他访问 Exchange 的方式都正常继续(RDP、OWA、Outlook、我的生产版本等)
-
我已使用 RDP 登录到我的服务器,并且正在运行 Perf Monitor 会话。当我的生产应用程序调用 EWS 时,我可以在图表中看到预期的峰值。但是当我的登台版本做同样的事情时,什么都没有。就好像它被防火墙了,但我相信它不是。 443 端点在 Azure VM 中打开,Windows 高级防火墙为所有访问(域、私有、公共)打开了 443,没有 IP 限制。 IIS 有 443 绑定,没有 IP 限制。我的登台应用程序可以访问 EWS 一次,然后它就会中断。好像有什么防洪什么的。可能吗?
标签: c# azure exchangewebservices