Visual Studio 2013: debugging using an IP address instead of LocalHost

I have a WCF REST service that is debugging and works fine when using IISExpress and this URL:

http://localhost:<portnumber> 

However, for various reasons, I need it to work with IIS Express and this address:

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

When I tried it initially, I got an HTTP 400 error: Bad request. Then I used google and ended up here: Connecting to Visual Studio debugging IIS Express server via LAN

This thread asked the EXACT same question, and the answer gave me part of the way. Following the most excellent tips in this thread, I did the following:

Edit IISExpress Host.config:

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

2: Changed all 17 of these lines:

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

To look like this:

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

(port number changed on all 17 lines)

Visual Studio:

Closed, open again, but works as admin

Windows Firewall:

Added appropriate port to allow incoming connections

CMD:

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

Run this command, where XXXXX is the port number.

Now when I run debug and go to this url:

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

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

This is progress because the browser now at least hits IISExpress, right? But I'm not sure about how to overcome this error 503. I have been searching Google for this error for a while, but nothing depends on what I'm trying to do.

Any ideas?

+5
source share
1 answer

Figured it out. Instead of this:

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

change it to this:

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

Source: https://habr.com/ru/post/1215253/


All Articles