'Error: ConnectionRefused (0x274d). System.Net.Sockets.SocketException No connection could be made because the target machine

I had same issue ( link https://superuser.com/questions/394223/iis-cannot-access-folder-for-website-hosting)

I hosted web api service in iis when i hosted i got internal server error i found solution here for that http://support.microsoft.com/kb/942055 i changed as per this doc. After that i got the error in like this

        Fiddler] The connection to 'localhost' failed. 
        Error: ConnectionRefused (0x274d). 
    System.Net.Sockets.SocketException No connection could be made because the target     machine actively refused it {ip address}

How to resolve this?

Solution?



Solution 1:[1]

I believe this is related to project configuration file for IIS, when the virtual directory path in the config doesnt match the actual path to the project folder.

I encountered this error when my project folder structure was changed, but applicationhost.config wasn't changed accordingly.

What I did to fix it: (My Web Project) -> Properties -> Web, at the "Server" settings, where the application url is set -> "Create Virtual Directory".

This introduced the following change in applicationhost.config

- <virtualDirectory path="/" physicalPath="D:\Git\project\Meow" />
+ <virtualDirectory path="/" physicalPath="D:\Git\project\src\Meow" />

I also assume this can be the case if someone else commits his path to project into source control, and you pull it, overwriting your local changes.

Solution 2:[2]

I went to the XAMPP control panel, then to config/service and ports settings and I changed the Apache main port to 81 (the same in the httpd.conf) and it worked for me since I was getting this error when I tried to access Mysql.

Solution 3:[3]

All I had to do get the browser reconnect to localhost and start serving http reqs from my web project was to do the following 1. start CLI (run as admin) 2. ng build (rebuild) 3. ng serve (run again)

Solution 4:[4]

it's DNS problem try:

ipconfig /flushdns

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 evictednoise
Solution 2 Jesse
Solution 3 user13317121
Solution 4 Nima Derakhshanjan