Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio 2013: Debug using IP Address instead of LocalHost

I have a WCF REST service which debugs and works perfectly when using IISExpress and this url:

http://localhost:<portnumber>

However, for various reasons, I need it to also work with IIS Express and THIS url:

http://<ip address>:<portnumber>

When I tried originally, I got HTTP error 400: Bad request. Then I used google and ended up here: Connecting to Visual Studio debugging IIS Express server over the lan

That thread asked the EXACT same question, and the answer got me part of the way there. Following all the most excellent advice in that thread, I did the following:

Edit the IISExpress Host.config:

1: Open the %USERPROFILE%\My Documents\IISExpress\config\applicationhost.config file.

2: Changed all 17 of these lines:

<binding protocol="http" bindingInformation="*:8080:localhost" />

To look like this instead:

<binding protocol="http" bindingInformation="*:8080:*" />

(the port number varied on all 17 lines)

Visual Studio:

Closed, re-opened but ran as admin

Windows Firewall:

Added the port in question to allow incoming connections

CMD:

netsh http add urlacl url=http://*:XXXXX/ user=Everyone

Ran that command, where XXXXX is the port number.

Now, when I start debug and go to this URL:

http://<ip address>:<portnumber>

Instead of "HTTP error 400: Bad request", I now get "HTTP Error 503. The service is unavailable."

This is progress, as the browser is now at least hitting IISExpress, right? But I'm not sure at this point how to get past this 503 error. I've been searching google for that error for a while, but nothing is specific to what I'm trying to do.

Any ideas?

like image 477
Casey Crookston Avatar asked Sep 29 '22 13:09

Casey Crookston


1 Answers

Figured it out. Instead of this:

<binding protocol="http" bindingInformation="*:8080:*" />

change it to this:

<binding protocol="http" bindingInformation="*:8080:" />
like image 172
Casey Crookston Avatar answered Oct 07 '22 19:10

Casey Crookston