Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio: How to make Cassini listen on ::1?

Visual Studio's internal development web-server only listens for connections from the local computer.

Unfortunatly, the web-server only binds to the IPv4 loopback address:

127.0.0.1

On machines with IPv6 enabled (i.e. Windows Vista, Window 7), it does not bind to the IPv6 loopback address:

::1

When you push play in Visual Studio, or open the web-site from the notification area icon, the browser launches and tries to connect to "localhost":

http://localhost:53289/WebSite/

localhost is not a real address, but an alias. On Vista and later it is defined as:

C:\Windows\System32\drivers\etc\hosts

::1        localhost

So you cannot browse to the web-site running on the local host by trying to connect to localhost, you have to change it to 127.0.0.1


How can i make Visual Studio's internal web-server also listen on

::1

in addition to

127.0.0.1

?

like image 286
Ian Boyd Avatar asked Nov 05 '22 20:11

Ian Boyd


1 Answers

As far as I know, you can not use IPv6 with Visual Studio's development server. You can set it up with IIS however.

You can find instructions on how to do this here: http://blogs.iis.net/.../using-ipv6-with-iis7.aspx.

Another option is to do what I've done before, which is to remove the IPv6 localhost definition from your hosts file. Just remove this line:

::1        localhost

Make sure you include a reference to 127.0.0.1 in your hosts file as an alternative, otherwise you will have bigger problems. You should never need to use localhost as an alias for ::1, at least until the world switches exclusively to IPv6, which won't be for a long time anyway.

like image 84
Dan Herbert Avatar answered Nov 16 '22 05:11

Dan Herbert