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?

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
  • 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. – Chris Marisic Jul 13 '11 at 17:51
  • 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. – Horst Walter Jul 13 '11 at 17:56
  • Ok, it is: http://en.wikipedia.org/wiki/Cassini_Web_Server – Horst Walter Jul 13 '11 at 18:05

4 Answers4

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.

Martin
  • 39,569
  • 20
  • 99
  • 130
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

Community
  • 1
  • 1
Bas van Dijk
  • 9,933
  • 10
  • 55
  • 91
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

Matt Penner
  • 1,082
  • 12
  • 22
  • 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. – Horst Walter Oct 13 '11 at 22:46
  • 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? – epalm Sep 07 '14 at 00:53
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)

M4V3R1CK
  • 765
  • 3
  • 9
  • 22