I have two asp.net core 3.1 api solution . I am trying to call port number 2005 from port number 2001 using http client
public const string _callurl = "http://localhost:2005/api/Product/Productspecific";
.i am getting exception like No connection could be made because the target machine actively refuse what will be the issue?
- public async Task<Resultclass> ResultcallHttpclient(Input input)
- {
- var requestUri = string.Format(UrlPatterns._callurl, _Uri);
- StringContent content = new StringContent(JsonConvert.SerializeObject(input), Encoding.UTF8, "application/json");
- var httpResponse = await _singleton.Client.PostAsync(requestUri,content);
- switch (httpResponse.StatusCode)
- {
- case HttpStatusCode.OK:
- var jsonResponse = await httpResponse.Content.ReadAsStringAsync();
- return JsonConvert.DeserializeObject<Resultclass>(jsonResponse);
- case HttpStatusCode.NotFound:
- return QualityCheckResults.CreateAsNotFound();
- default:
- }
- }