0

when I am trying to launch my .Net Core WebApi project I receive System.Net.Sockets.SocketException No connection could be made because the target machine actively refused it 127.0.0.1:50620 error from Fiddler (in other words localhost refused to connect in browser).

I know there are thousands of questions about this issue but neither one of them managed to fix my problem.

What I did so far:

  • Played with hosts file of Windows - this seemed not to be the case.

  • Made another project that use same port - results were it builds with no problems so I concluded there no problems with this specific port.(Despite that I tried changing my port , but no success.)

  • Checked all my project/application settings files for any differences that might be causing the problem between the project I am failing to build and the one template project I am building successfully. - there are none drastic differences.

  • Turned off my firewall so I can check if firewall is the problem of this - project failed to build with firewall off.

  • Deleted temporary .NET files and assemblies related to the project.

  • Used netstat to see if someone is already listening to that port. - doesn't seem to be the case give the fact that I can build another project using the same port.

After one week of searching answers in internet and stackoverflow in general I am still stuck so I will be glad to use an extra hand to fix this.

If you need anything else as information for instance content of project.json file, applicationhost.json, etc. please write a comment and I will provide all the information I can in order to fix this.

kuskmen
  • 3,648
  • 4
  • 27
  • 54

1 Answers1

0

This problem occures because you do not have a certificate for localhost.

You have to install a self signed certificate for localhost. Then you would only get ERR_INSECURE_RESPONSE which can be turned of in the browser settings.

To get rid of all errors you have to install a localhost certificate which has a trusted root authority.


Another option is explained here.

Community
  • 1
  • 1
NtFreX
  • 10,379
  • 2
  • 43
  • 63
  • How come then I have problem with only one project other than template one? If I didn't have such certificate will I be able to build Microsoft Web API template project? – kuskmen Dec 17 '16 at 14:58
  • @kuskmen I do not know what exactly in the `setup` happens that a certificate is required but I do know that the `WebSocket` handshake fails without any sepcific error message when there is no certificate. If a certificate exists only the browser will check for the validility of the trusted authority. – NtFreX Dec 17 '16 at 15:01
  • @kuskmen but I would also check if your server is really running as described here http://stackoverflow.com/questions/2972600/no-connection-could-be-made-because-the-target-machine-actively-refused-it – NtFreX Dec 17 '16 at 15:04