This post about an issue I faced while debugging an asp.net mvc application in Google Chrome. (Version 40.0.2214.111 m). I bulit my website using MVC 4 Template in Visual Studio 2010, designed a top menu and started testing the UI. By default visual studio was opening up the homepage in IE 🙂 , everything was running as expected, so just to see how it works in Chrome, I opened IIS Express url (localhost:6000), and the below error shown up “This webpage is not available“.
Show details link revealed more info Chrome Error code: ERR_UNSAFE_PORT
Alright it looks like not all ports are supported by the chrome browser. This is because of Chrome restricting the local ports.
How To fix the issue
1. Change Website Port setting in Visual Studio (Recommended) OR
2. Add the testing port(here 6000) as an allowed port to Google Chrome Explicitly
How To Change Website Port setting in Visual Studio
1. Right click your website project in the solution, select properties, select “Web” Tab in the Servers Section/Use Visual Studio Development Server, Specific Port give a random port no that is not used by any other application in your machine.
How to allow port in Google Chrome explicitly :
Right click on the chrome shortcut (Desktop/StartMenu/Quick Launch) -> Properties -> Change the target:
“C:\Program Files (x86)\Google\Chrome\Application\chrome.exe” –explicitly-allowed-ports=81,84,87
New shortcut command should like this , if Chrome is installed on the default installation location.