HTTPError Exception Message not displaying when webapi is run on Server vs being run locally

I found that these needed to be turned on in the GlobalConfiguration for the webapi itself: 1: config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.LocalOnly; 2: config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; 3: config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Never; The server actually determines how much detail to display, the default is LocalOnly. Our logging method is not considered local, I guess because it is not actually … Read more

How to set large string inside HttpContent when using HttpClient?

I figured it out with the help of my friend. What you would want to do is avoid using FormUrlEncodedContent(), because it has restrictions on the size of the uri. Instead, you can do the following : var jsonString = JsonConvert.SerializeObject(post_parameters); var content = new StringContent(jsonString, Encoding.UTF8, “application/json”); Here, we don’t need to use HttpContent … Read more

Retrying HttpClient Unsuccessful Requests

Instead of implementing retry functionality that wraps the HttpClient, consider constructing the HttpClient with a HttpMessageHandler that performs the retry logic internally. For example: public class RetryHandler : DelegatingHandler { // Strongly consider limiting the number of retries – “retry forever” is // probably not the most user friendly way you could respond to “the … Read more

Where is HttpContent.ReadAsAsync?

It looks like it is an extension method (in System.Net.Http.Formatting): HttpContentExtensions Class Update: PM> install-package Microsoft.AspNet.WebApi.Client According to the System.Net.Http.Formatting NuGet package page, the System.Net.Http.Formatting package is now legacy and can instead be found in the Microsoft.AspNet.WebApi.Client package available on NuGet here.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)