Windowsサービスの.NetクライアントはPHP Webサービスと通信しています。基本的なアイデアは、.Netクライアントは、データベースに書き込むためにPHPに情報を送信する、このプロセスは約1分かかる、問題は、HttpResponseMessageがBadGatewayに付属して、面白いのは実際には1分以上かかる場合でもデータベースに書き込むことができます。.Net HttpResponseMessageは、1分以上かかるとBadGatewayを受信します。
//code for the stuff making
Logger.WriteLog("Sending Stuff");
using (var client = new HttpClient())
{
client.Timeout = new TimeSpan(0,10,0);
httpResponseMessage = client.PostAsync(url, content).Result;
Logger.WriteLog(httpResponseMessage.StatusCode.ToString());
Logger.WriteLog(httpResponseMessage.ToString());
}
しかし、それでもまだ、それを超える1分応答、それはあまりにも10分のタイムアウトを持っていると仮定PHPのWebサービスで失敗:私は10分にHttpClientをのタイムアウトを設定してみてください。私は完全な応答を記録し、私は悪いゲートウェイを得た:
2016-04-25 11:12:24,045 INFO - *Sending Stuff
2016-04-25 11:13:23,413 INFO - OK
2016-04-25 11:13:23,414 INFO - StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Pragma: no-cache
Connection: close
Cache-Control: no-store, must-revalidate, no-cache, post-check=0, pre-check=0
Date: Mon, 25 Apr 2016 14:12:37 GMT
Set-Cookie: PHPSESSID=lbhsue3pstc8smqihkoe0nouj1; path=/
Server: Apache/2.2.15
Server: (CentOS)
X-Powered-By: PHP/5.6.19
Content-Length: 52
Content-Type: application/json; charset=UTF8
Expires: Thu, 19 Nov 1981 08:52:00 GMT
}
//-------------------------------------------------------------------------------------------------------------------------------------------------
2016-04-25 11:14:42,931 INFO - *Sending Stuff
2016-04-25 11:15:44,273 INFO - BadGateway
2016-04-25 11:15:44,274 INFO - StatusCode: 502, ReasonPhrase: 'Proxy Error', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Connection: close
Date: Mon, 25 Apr 2016 14:14:43 GMT
Content-Length: 499
Content-Type: text/html; charset=iso-8859-1
}
//------------------------------------------------------------------------------------------------------------------------------------------------
2016-04-25 11:25:28,471 INFO - *Sending Stuff
2016-04-25 11:26:27,495 INFO - OK
2016-04-25 11:26:27,497 INFO - StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{
Pragma: no-cache
Connection: close
Cache-Control: no-store, must-revalidate, no-cache, post-check=0, pre-check=0
Date: Mon, 25 Apr 2016 14:25:41 GMT
Set-Cookie: PHPSESSID=ja6f30mqlnhtdl8p44hddr43c3; path=/
Server: Apache/2.2.15
Server: (CentOS)
X-Powered-By: PHP/5.6.19
Content-Length: 52
Content-Type: application/json; charset=UTF8
Expires: Thu, 19 Nov 1981 08:52:00 GMT
}
私の希望だった、ということbadgatewayの理由が、それは違いない作るタイムアウト。誰かが、たとえPHPでの処理がタスクを終了したとしても、どうしてbadgatewayの可能性があるのか教えてもらえますか?前もって感謝します! PD:英語に申し訳ありません。
....私は100%確実なことはできませんので、第三者のソフトです。しかし、.Netはそれ自体が私と関係している可能性がないという意味で、悪意のある言動の反応を起こすことはできないのですか?窓は彼のサービスの1つからのhttp要求を終了できますか?または.netフレームワーク? – Aferrercrafter
はい、HTTP要求はクライアント側ではさまざまな理由で終了する可能性がありますが、HTTPステータスコードとしてマニフェストされていないことを98%確信しています。 HTTPステータスコードは、相手側のサーバーからのみ送信される必要があります。 –