.NET FrameworkのHttpWebRequestはHTTPの100 Continueの処理が不完全
[ 2009.11.25 ] by h_tab | Categories:.NET
とのことです。
具体的には、POSTの際やプロキシ接続の際に、
System.Net.WebException: 基礎になる接続が閉じられました: 接続が予期せずに閉じられました
という例外が発生している場合は、100 Continue処理の不具合を疑った方がよさそうです。
以下のコードにて回避可能とのこと。
ServicePoint currentServicePoint = request.ServicePoint;
if (currentServicePoint == null)
{
currentServicePoint = ServicePointManager.FindServicePoint(new Uri(url));
}
if (currentServicePoint.Expect100Continue == true)
{
currentServicePoint.Expect100Continue = false;
}
いわゆるバッドノウハウなんですが、とりあえずメモしておきます。














最近のコメント