I have created an Web API application.
This application I have hosted on one server.
Now I am calling a post method of that (hosted ) application using async call in another application, so If I put a debugger then I am getting an Internal Server Error when call a Web API by async.
Bellow is my code
public async void PostRequest(string name)
{
try
{
string name = "rupesh";
Uri requestUri = new Uri("http://xxxxx:2565/api/Registration/SignUp"); //replace your Url
string json = "";
json = Newtonsoft.Json.JsonConvert.SerializeObject(name);
var objClint = new System.Net.Http.HttpClient();
System.Net.Http.HttpResponseMessage respon = await objClint.PostAsync(requestUri, new StringContent(json, System.Text.Encoding.UTF8, "application/json"));
string responJsonText = await respon.Content.ReadAsStringAsync();
}
catch (Exception ex)
{
var er = ex.Message.ToString();
}
}
Give me some solution.
Thanks