を使用してPUTリクエストは、私は、URLを作成し、Flurlを使用してPUT
要求を行っていますとNullReferenceExceptionとき、次のようにFlurl
using (var client = new Url("myurl"))
.ConfigureClient(c => c.HttpClientFactory = new CompressHttpClientFactory())
.WithCookie(new System.Net.Cookie("name", "value", "/", "domain"))
{
var content = new StringContent("json here", Encoding.UTF8, "application/json");
var response = await client.PutAsync(content)
}
しかしPutAsync
を呼び出すときに、私は例外を取得しています:
System.NullReferenceExceptionが発生しました HResult = 0x80004003 メッセージ=オブジェクト参照がオブジェクトのインスタンスに設定されていません。 ソース= Flurl.Http のStackTrace:Flurl.Http.FlurlClient.ReadResponseCookiesで (HttpResponseMessage応答)System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(タスクのタスク)でFlurl.Http.FlurlClient.d__28.MoveNext() で System.Runtime.CompilerServices.TaskAwaiter`1.GetResultでSystem.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(タスクのタスク) で ()
私はtry/catch
を使用し、例外を無視すべきか?