Cannot connect ASP.NET development server (VS2010) via IP address
Asked Answered
F

4

10

Visual Studio 2010 / ASP.NET project / ASP.NET Development server

I can run and debug my VS2010 ASP.NET project from my development computer (where VS2010 runs). URL: http://localhost:port/MyApp.htm works fine.

Since I want to test the application from an IPad as well, I need to call the application with its IP address such as http://192.168.0.132:port/MyApp.htm

To my surprise this does not work, neither from the IPad, nor from the dev. computer itself. It is not a matter of connectivity, the address is correct / ping is possible.

(Note that I have no IIS installed on this machine, actually the ASP.NET application is plain HTML+JS, I use VS2010 just for debugging.)

Any workaround for this?

Forfeiture answered 13/7, 2011 at 17:49 Comment(3)
Did you try changing it to run IIS Express instead of Cassini? Cassini shouldn't be used anymore it is not similar enough to IIS whereas IIS express is basically IIS.Nagy
Is Cassini the (so called) "development server"? I have no IIS installed on this machine, but the same idea crossed my mind. Nevertheless I was curious what the issue was... and if it can be resolved.Forfeiture
Ok, it is: en.wikipedia.org/wiki/Cassini_Web_ServerForfeiture
P
11

The Visual Studio Development Server will only serve pages to the local machine:

From Web Servers in Visual Web Developer:

If you cannot or do not want to use IIS as your Web server, you can still test your ASP.NET pages by using the ASP.NET Development Server. The ASP.NET Development Server, which is included with Visual Web Developer, is a Web server that runs locally on Windows operating systems, including Windows XP Home Edition. It is specifically built to serve, or run, ASP.NET Web pages under the local host scenario (browsing from the same computer as the Web server). In other words, the ASP.NET Development Server will serve pages to browser requests on the local computer. It will not serve pages to another computer. Additionally, it will not serve files that are outside of the application scope. The ASP.NET Development Server provides an efficient way to test pages locally before you publish the pages to a production server running IIS.

The ASP.NET Development Server only accepts authenticated requests on the local computer. This requires that the server can support NTLM or Basic authentication.

If you wish to test pages remotely you will need to use IIS or IIS Express.

Poe answered 13/7, 2011 at 18:7 Comment(0)
B
2

I ran into this same problem and found a great solution. You can use SPI Port Forwarder (or a similar tool) to forward outside requests to the VS development web server. It works great and you can turn it on and off as needed.

Check out the info here: Accessing the Visual Studio ASP.NET Development Server from iPhone & iPad

Bergh answered 13/10, 2011 at 20:27 Comment(2)
BTW, did you accidentally vote this question down -exactly with your answer the question has been voted down. Since it is unlikely to downvote and answer the same question I was just curious.Forfeiture
I'm using SPI Port Forwarder but still getting Bad Request - Invalid Hostname HTTP Error 400 Anything else I need to do other than just forward the port?Saporous
S
2

http://opensource.oxyva.nl/simple-development-proxy seems to work around Visual Studio Express 2012 for Web not allowing connections from other devices like iPhone, iPad etc. which result in "HTTP Error 400: Bad Request - Invalid Hostname"

There seems to be another solution as described in: visual web developer Web service on debug HTTP/1.1 400 Bad Request

Sheikdom answered 3/12, 2012 at 10:53 Comment(1)
You are rocking @osi. Most simple of all solutions i tried. Thanks a tonne. Wish I could have given you +10 :)Burn
I
1

You need to set up a WebSite in IIS, and deploy solution to virtual directory for the application to be accessible through an IP address outside of localhost(127.0.0.1)

Injury answered 13/7, 2011 at 18:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.