Objective
I'm looking for the simplest-possible, step-by-step setup process for debugging my ASP.NET MVC 4 application using my IP address as the URL. I want to be able to access the application from my Android phone, which is connected to my local network via Wi-Fi, using my computer's local IP address (e.g. - http://192.168.1.109:25968
). I'm running Visual Studio 2012 RC on Windows 7.
This question has been addressed by two other questions (this one, and this one), but the answers are extremely brief and aren't helping me at all. I've had to resolve this issue before by banging on my computer and mindlessly changing every setting until something worked. I don't want to have to go through that again. I want to understand what I'm doing this time.
Setup Information
The project is just a default ASP.NET MVC 4 Internet Application. I'm pretty sure I haven't changed anything yet.
The Web tab in my application's Properties is set to "Use Local IIS Web Server", and I have "Use IIS Express" checked. The Project url is http://localhost:25968/
. I see that the "locahost" there might be a problem, but VS won't let me put in an IP address or wild cards.
My IIS Express applicationhost.config file for my application are as follows.
<site name="APPLICATION_NAME" id="13">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\USERNAME\Documents\Visual Studio 11\Projects\APPLICATION_NAME" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:25968:localhost" />
</bindings>
</site>
What's Happening
When I connect to the site from the host computer with http://localhost:25968
it works great. If I try to use http://192.168.1.109:25968
from the host computer, I get "Bad Request - Invalid Hostname, HTTP Error 400. The request hostname is invalid." Using this same URL from another computer on the network, it just times out.
Hi, General ASP.NET works absolutely fine in Mobile browsers[HTML Compatible]. You can add the following META tags to make your site mobile compatible.
What is Debugging in ASP.NET? Debugging is the process of adding breakpoints to an application. These breakpoints are used to pause the execution of a running program. This allows the developer to understand what is happening in a program at a particular point in time.
Grant yourself permission to bind to both localhost and wildcard network adapters, configure IIS Express to bind to them, and open the port on your firewall. By using a wildcard, you don't have to reconfigure when your IP address changes.
Step details: (they assume a port number of 5555 - use your actual port instead)
Run these commands from a command prompt as Administrator:
netsh http add urlacl url=http://localhost:5555/ user="NT AUTHORITY\INTERACTIVE"
netsh http add urlacl url=http://*:5555/ user="NT AUTHORITY\INTERACTIVE"
In .vs\config\applicationhost.config (or for pre-VS2015, %USERPROFILE%\Documents\IISExpress\config\applicationhost.config), add a wildcard binding to your site. The result should look like this:
<site name="..." id="...">
<!-- application settings omitted for brevity -->
<bindings>
<binding protocol="http" bindingInformation="*:5555:localhost" />
<binding protocol="http" bindingInformation="*:5555:*" />
</bindings>
</site>
Open the firewall port for your IIS Express site. You can do this from an administrative command prompt:
netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=5555 profile=private remoteip=localsubnet action=allow
Give this a shot:
netsh http add urlacl url=http://192.168.1.109:25968/ user=everyone
From: http://johan.driessen.se/posts/Accessing-an-IIS-Express-site-from-a-remote-computer
You might be able to substitute your computer's hostname for the IP address so you don't have to re-run that every time your IP changes.
I needed to perform all of the steps from the link that cfeduke provided. (Not just the one he describes in his answer.)
<binding protocol="http" bindingInformation="*:58938:192.168.1.42" />
to applicationhost.config after the binding for 'localhost'.netsh http add urlacl url=http://192.168.1.42:58938/ user=everyone
netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=58938 profile=private remoteip=localsubnet action=allow
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With