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
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
(jsonResponse); - case HttpStatusCode.NotFound:
- return QualityCheckResults.CreateAsNotFound();
- default:
- }
- }

Rijwan AnsariRank #82 · 24.2K reputationPosted Feb 8, 2021, 9:44 AM EST
Kiran MohantyRank #821 · 2.8K reputationPosted Feb 8, 2021, 3:28 AM EST
Sujeet RamanRank #1,329 · 1.3K reputationPosted Feb 8, 2021, 4:05 AM EST
localhost refused to connect.
Try:
Sachin SinghRank #66 · 26.2K reputationPosted Feb 8, 2021, 6:37 AM EST
Kiran MohantyRank #821 · 2.8K reputationPosted Feb 8, 2021, 6:47 AM EST
Sujeet RamanRank #1,329 · 1.3K reputationPosted Feb 8, 2021, 7:00 AM EST
Kiran MohantyRank #821 · 2.8K reputationPosted Feb 8, 2021, 7:03 AM EST
Sujeet RamanRank #1,329 · 1.3K reputationPosted Feb 8, 2021, 7:11 AM EST
Kiran MohantyRank #821 · 2.8K reputationPosted Feb 8, 2021, 7:18 AM EST
Sujeet RamanRank #1,329 · 1.3K reputationPosted Feb 8, 2021, 7:34 AM EST
Kiran MohantyRank #821 · 2.8K reputationPosted Feb 8, 2021, 7:52 AM EST
Sujeet RamanRank #1,329 · 1.3K reputationPosted Feb 8, 2021, 8:03 AM EST
Kiran MohantyRank #821 · 2.8K reputationPosted Feb 8, 2021, 8:17 AM EST
Sujeet RamanRank #1,329 · 1.3K reputationPosted Feb 8, 2021, 8:34 AM EST
Kiran MohantyRank #821 · 2.8K reputationPosted Feb 8, 2021, 8:39 AM EST
Sujeet RamanRank #1,329 · 1.3K reputationPosted Feb 8, 2021, 8:49 AM EST
Kiran MohantyRank #821 · 2.8K reputationPosted Feb 8, 2021, 9:19 AM EST
Sujeet RamanRank #1,329 · 1.3K reputationPosted Feb 8, 2021, 9:31 AM EST
Sujeet RamanRank #1,329 · 1.3K reputationPosted Feb 8, 2021, 9:57 AM EST