Search code examples
asp.net-mvcvisual-studiolocalhostiis-express

My browser cannot find localhost when running VS2017 project and says 'Cannot reach this page'


I've been making some changes to my MVC project which earlier today was running fine. However, I installed some new software including PostGreSql and npgsql for Visual Studio and now when I run my project it seems IIS can no longer find localhost. The actual message is 'Cannot reach this page. Make sure the web address http://localhost:4068 is correct'.

I've checked that my IIS is running and I've tried deleting my IISExpress folder, deleting the config file in .vs/config but so far nothing seems to work and I don't even know what it was that caused it. If anyone has had this issue, please let me know how you resolved it.


Solution

  • You need to put an entry in your c:\Windows\System32\Drivers\etc\hosts File like

    127.0.0.1 localhost
    

    Or simply try http://127.0.0.1:4068 as url

    Editing the file needs administrative rights so you might run your editor as administrator.