Solve – localhost refused to connect

With Visual Studio -2015 i received an error while tried to run previous MVC project

the below message appeared in my browser, i was searching for the perfect solution.

This was the few steps how we can solve this issue. Open VS-2015 with existing MVC project > Unload Project like below image.

Right click on unloaded project > Edit .csproj file like below.

Remove the marked lines in below image

  • DevelopmentServerPort
  • DevelopmentServerVPath
  • IISUrl

Finally reload the project

Build & Run the project, it is solved 🙂

Author:

Since March 2011, have 8+ years of professional experience on software development, currently working as Senior Software Engineer at s3 Innovate Pte Ltd.

12 thoughts on “Solve – localhost refused to connect”

  • Aecio Lemos says:

    Reply

    You rock, thanks. You solved a problem I was having for hours and I could not solve. Very frustrating. Thanks a million.

    • Reply

      I also spent several hours trying to figure out what is going on. super simple call from angular and yet even manually I could not get it working. I could see that mvc action was registring the action call but it never got into the method. I could see that the url and parameter were perfect but it still would not work and visual studio does not tell what the problem or solution is.

      Your instructions worked wonderfully.

  • Nabin Thapa says:

    Reply

    I follow the same process but it didn’t solve my visual studio problem of localhost refused.

  • Reply

    I have follow the same procedure but it not working in visual studio 2013… plz give me a another way to solve this..

  • Reply

    I have follow the same procedure but it not working in visual studio 2013… plz give me a another way to solve this..

  • Reply

    Even I tried this getting same problem.
    Do you have any other solution ??????
    please help regarding this..

  • Reply

    Wasted so much time trying to find out why this happened! Thanks so much for sharing.

    Still doesn’t explain why this worked for so long and all of a sudden this error started to occur. Once sorted, I tried to revert back to the original port and the error came back. Doesn’t make any sense, well without understanding what’s causing this.

    Anyway, thanks again.

  • Do you mind if I quote a few of your posts as long as I provide credit and sources back to your website?
    My website is in the exact same niche as yours and my users would really benefit from a lot of the information you provide here.

    Please let me know if this alright with you. Cheers!

Leave a Reply