You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HttpClient client = new HttpClient(); client.PostAsJsonAsync(url, some object);
These code can work correctly in dev environment netcore3.1 using vs2019. it can send json object data to the server, But when deployed to iis with stand alone mode (already deploy with System.Net.Http.Formatting.dll), the httpclient can not send json object to the same server. There has no error occur, just only the server received a null object data. Then I change these code to next :
first defined a new class public class JsonContent : StringContent { public JsonContent(object obj) : base(JsonConvert.SerializeObject(obj), Encoding.UTF8, "application/json") { } }
then client.PostAsync(url, new JsonContent(data));