CloudFlare の背後にあるサーバーと通信しています。HTTP POST リクエストのコンテンツを受信していないかのように、サーバーからエラーが発生することはめったにありません。めったに発生しません(おそらく1〜2%)。また、同じリクエストをすぐに再送信すると、ほとんどの場合 (~99%) は正常に機能します。
サーバーが CloudFlare の背後にない場合、または別の同様のサービスを使用している場合、サーバーに問題はありませんでした。また、サーバーを CloudFlare から一時的に移動すると、問題はなくなります。CloudFlare の背後にある別のサーバーにもまったく同じ問題があります。
C# .NET 4.5 を使用しています。接続は保護されています (HTTPS)。
Fiddler を使用して HTTP 要求/応答をキャプチャしました。「悪い」リクエストと「良い」リクエストの違いはまったくありません。
POST https://btc-e.com/tapi HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Key: ****************
Sign: e94eb19d4cdf29b6629c2acc6934bacdf502bdc93c14a44521ef9d64823f4ab560ef14fce468b7df897f0b2f2f4677c4191801f7453c784bda7fd0ede4b95f59
Host: btc-e.com
Content-Length: 42
nonce=1362901653&method=OrderList&active=1
======================================================
HTTP/1.1 200 OK
Server: cloudflare-nginx
Date: Sun, 10 Mar 2013 08:41:16 GMT
Content-Type: text/html
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/5.4.12
X-Frame-Options: DENY
Expires: Sun, 17 Mar 2013 08:40:56 GMT
Cache-Control: max-age=604800
Set-Cookie: __cfduid=****************; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.btc-e.com
CF-RAY: 4ceb4731fea02d9
10e
{"success":0,"error":"*************"} 0
0
以下のコードを使用していますが、関連性はないと思います:
byte[] data = Encoding.ASCII.GetBytes(BuildPostData(args)); //values are properly encoded using HttpUtility.UrlEncode
HttpWebRequest request = WebRequest.CreateHttp(ApiUri);
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = data.Length;
request.Timeout = 5000;
request.Headers.Add("Key", Key);
request.Headers.Add("Sign", sign);
using (Stream outStream = request.GetRequestStream())
{
outStream.Write(data, 0, data.Length);
outStream.Flush();
}
using (WebResponse response = request.GetResponse())
using (var streamReader = new StreamReader(response.GetResponseStream()))
result = JObject.Parse(streamReader.ReadToEnd());
私がすでに成功せずに試したこと:
- HTTP1.1/1.0
- キープアライブのオン/オフ
- 100回連続のオン/オフを期待
- クッキーの有効化/無効化
- チャンク送信のオン/オフ
アイデアはありますか?
更新: 2013-05-01 問題はなくなりました。クライアント側に変更はありません。3~4週間で消えてしまった…