屏蔽WebApi中 请求资源不支持 http 方法"GET"的提示信息
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { return base.SendAsync(request, cancellationToken).ContinueWith(responseTask => { HttpResponseMessage response = null; Task.Run(async () => { response = await responseTask; }) .GetAwaiter() .GetResult(); HttpError error; response.TryGetContentValue(out error); if (error != null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } else { return response; } }); }