Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forumguidelines
Bheema Vidyuth
1.5k
480
131.8k
No connection could be made because the target machine actively refuse
Feb 8 2021 7:57 AM
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
:
}
}
Reply
Answers (
19
)
Convert aspx webpage output to html, word or pdf document
System.Runtime.InteropServices.COMException (0x800A03EC)