question

JamesBaron-4657 avatar image
0 Votes"
JamesBaron-4657 asked ·

Can't listen on anything but localhost (ASP MVC Framework IIS Express)

I'm unable to get a .Net Framework MVC project to listen on anything except localhost.

If I change

       <IISUrl>http://localhost:2319/</IISUrl>

to

       <IISUrl>http://eadev:2319/</IISUrl>

my project won't even load.

I get the following error:


Creation of the virtual directory http://eadev:2319 failed with the error: Cannot create the Web site 'http://eadev:2319'. You must specify "localhost" for the server name.


I've seen just tons of issues on this, and someone in my own company has this working, but I cannot get it to work. I actually set him up. And I still can't do this.

I've tried

 netsh http add url=http://eadev:2319 users=everyone

That just gives me access denied errors when I run it from the console, but it's still trying to load localhost:2319

I deleted the .vs directory. I added entries to the .vs/app/config/applicationhosts.config

I've added eadev to the hosts file.

Also, one thing that used to work is that I downloaded nginx for Windows and setup a reverse proxy, but now it just says bad gateway. I even setup an ssh tunnel. I'm assuming now it's being picky about headers. I can access http://localhost:2319, but not nginx proxy_pass http://localhost:2319 is now giving bad gateway, but it used to work. If I point the proxy_pass to http://example.org it works.

Edit: I found out that nginx is resolving to 127.0.0.1 and IIS Express just won't respond.

There are just so many answers to this and other people seem to have got it working, but I cannot.

vs-setup
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DSPatrick avatar image
0 Votes"
DSPatrick answered ·

Asp.Net MVC is not currently supported here on QnA. They're actively answering question in dedicated forums here.
https://forums.asp.net/1146.aspx/1?MVC


--please don't forget to Accept as answer if the reply is helpful--




·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

cheong00 avatar image
0 Votes"
cheong00 answered ·

First, IIS Express is intentionally written to bind on localhost only. And it's not related to "netsh http". (Actually it has a number of other hard-coded things that "get into the way" too, say it will not allow you to return customized error message of error HTTP status codes and so on, so I strongly recommands you to develop on IIS if you're not using Home editions of Windows)

Second, regarding the use of NGINX, I don't know why you can't make it work, but I used that and it works flawlessly.

Just to remind you that the port NGINX listen on should not be the same as IIS Express, or you'll need to use IP number instead of hostname.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.