2017-09-14 6 views
0

ローカルのinfluxDBにPOST要求を送信しようとしています。 私はのStatusCode取得しています:http://localhost:8086/write?db=mydbを「私は入れて私のポストマンでasp.netからのinfluxDBへのPOST要求中に不正な要求が発生しました

HttpClient client = new HttpClient(); 
HttpRequestMessage requestMessage = new HttpRequestMessage(HttpMethod.Post, "http://localhost:8086/write?db=mydb"); 
requestMessage.Content = new StringContent("cpu_load_short, host = server01, region = us - 345345 value = 0.34564 345345"); 
HttpResponseMessage response = client.SendAsync(requestMessage).GetAwaiter().GetResult(); 

を " '不正な要求'" と "cpu_load_short、ホスト= SERVER01、地域= US-345345値= 0.34564 345345" で:400、のreasonPhraseを私の体(生)、それは

答えて

2

を作品

request.ContentType = "application/x-www-form-urlencoded"; 

か、この

を使用し、その後にも知っていて、エンコードの種類について確認しているかのようなものにコンテンツタイプを設定してみてください
requestMessage.Content = new StringContent("cpu_load_short, host = server01, region = us - 345345 value = 0.34564 345345", Encoding.UTF8, "application/x-www-form-urlencoded"); // or whatever is the encoding type 

ContentTypeプロパティには、要求のメディアタイプが含まれています

関連する問題