因此在Azure中有一个奇怪的问题,我们可以使用一些帮助。我们已经自由地将它隔离到HTTPWebRequest(POST-GET正常工作)通过SSL。这个对我们客户的特殊请求可以在任何计算机上可靠地运行,但是,当我们启动Azure VM并运行它时,它会在90-95%的时间内失败。它起作用的事实是使这如此困难的原因。
有一件事让这更奇怪,就是这个同样的请求,在一旦Fiddler代理,Azure中100%的工作时间。安装Fiddler以帮助调试并且无法重现该问题。退出Fiddler,问题再次出现。
最有可能与SSL有关,然而,它完全起作用的事实让我完全感到困惑。我们已经能够从Azure VM中捕获成功的tracelog和失败的tracelog。
基础连接已关闭:连接已关闭 出乎意料..
另一个因素是客户端使用名为DataPower的产品,但不确定这是否只是此线程中的额外噪音。
答案 0 :(得分:2)
DotNetOpenAuth.Messaging.ProtocolException: Error occurred while sending a direct message or getting the response. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a receive. ---> System.IO.IOException: Received an unexpected EOF or 0 bytes from the transport stream.
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security._SslStream.StartFrameBody(Int32 readBytes, Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security._SslStream.StartFrameHeader(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security._SslStream.StartReading(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security._SslStream.ProcessRead(Byte[] buffer, Int32 offset, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.TlsStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.Connection.SyncRead(HttpWebRequest request, Boolean userRetrievedStream, Boolean probeRead)
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.GetResponse()
at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options)
--- End of inner exception stack trace ---
at DotNetOpenAuth.Messaging.StandardWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options)
at DotNetOpenAuth.Messaging.UntrustedWebRequestHandler.GetResponse(HttpWebRequest request, DirectWebRequestOptions options)
at DotNetOpenAuth.Yadis.Yadis.Request(IDirectWebRequestHandler requestHandler, Uri uri, Boolean requireSsl, String[] acceptTypes)
at DotNetOpenAuth.Yadis.Yadis.Discover(IDirectWebRequestHandler requestHandler, UriIdentifier uri, Boolean requireSsl)
at DotNetOpenAuth.OpenId.UriDiscoveryService.Discover(Identifier identifier, IDirectWebRequestHandler requestHandler, Boolean& abortDiscoveryChain)
at DotNetOpenAuth.OpenId.IdentifierDiscoveryServices.Discover(Identifier identifier)
at DotNetOpenAuth.OpenId.RelyingParty.AuthenticationRequest.Create(Identifier userSuppliedIdentifier, OpenIdRelyingParty relyingParty, Realm realm, Uri returnToUrl, Boolean createNewAssociationsAsNeeded)
真的质疑我的理智,
HttpWebRequest
工作,但切换到DotNetOpenAuth(似乎或多或少做同样的事情)导致它大部分无法正常工作在检查了可以检查的每一件事之后,我进入了网络适配器属性(在我的例子中,是Rackspace Cloud上的Citrix PV以太网适配器),单击配置,转到高级,禁用IPv4校验和卸载。然后它立即开始工作。
我不知道IPv4 Checksum Offload的作用,但它在这个虚拟机上无法可靠地运行。希望这有助于其他人!
答案 1 :(得分:0)
更改标题后强制在标题中传递凭据(通过http://www.west-wind.com/weblog/posts/2010/Feb/18/NET-WebRequestPreAuthenticate-not-quite-what-it-sounds-like),这就绕过了问题。
我们客户端的IBM Datapower在使用NetWorkCredential(例如req.Credentials = new NetworkCredential)来自Azure时重置连接的问题仍然存在。
我们无法解释为什么它在我们的本地计算机上运行代码时起作用,并且DataPower不会丢弃请求,但是,当它在Azure中时它会这样做。
至少我们有一个解决方法,如果我听到有关DataPower问题的任何回复,我们会通知您。