私のアプリはあるファイル(here is the url)をダウンロードしなければなりません。アプリケーションは、プロバイダ側の最近の変更後、私は '基本的な接続が閉じられた:送信時に予期しないエラーが発生しました。WebRequest:基盤となる接続が閉じられました
私はすべての関連情報をネットで読みましたが、推奨される修正はありません。
重要なお知らせ:コードはNet Framework 4.6でも問題なく動作しますが、3.5で動作する必要があります。
アイデア?
var url = new Uri(@"http://www.ezv.admin.ch/pdf_linker.php?doc=edecReceiptResponse_stylesheet_v_3_0");
var request = (HttpWebRequest)WebRequest.Create(url);
request.KeepAlive = false;
request.AllowAutoRedirect = true;
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36";
request.ProtocolVersion = HttpVersion.Version10;
更新:スタック:
System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> 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.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult result)
at System.Net.TlsStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.PooledStream.Write(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.ConnectStream.WriteHeaders(Boolean async)
もう一つ更新:フィドラーとSと比較して応答をhttpに接続するアプリをチェックここ
コードでありますnetで受信4.6(動作)netで3.5(失敗):
- 4.6は2つの応答、
- 3.5は、2つの応答、7バイトここでtestを行っwww.ezv.admin.chによってサポートされるプロトコルである1として各
どちらか 'www.ezv.adminため のWindows Updateから。ch'で接続が切断されるか、通信の問題が発生します(ネットワークの問題/ファイアウォール)。 – bradbury9
スタックトレースを表示 –
FiddlerまたはWiresharkからのHTTP要求/応答も表示してください。 –