47

Im testing an ASP.NEt site. When I execute it, it starts the ASP.NET Development Server and opens up a page.

Now I want to test it in the intranet I have.

  1. Can I use this server or I need to configure IIS in this machine?

  2. Do I need to configure something for it to work?

I've changed the localhost to the correct IP and I opened up the firewall.

Thanks

Artur Carvalho
  • 6,901
  • 10
  • 76
  • 105
  • Maybe it helps someone else: you can use www.browserstack.com to access VMs with different browser versions directly from the dev machine. (i have no affiliation with the company) – Artur Carvalho Apr 17 '13 at 20:16

10 Answers10

50

Yes you can! And you don't need IIS

Just use a simple Java TCP tunnel. Download this Java app & just tunnel the traffic back. http://jcbserver.uwaterloo.ca/cs436/software/tgui/tcpTunnelGUI.shtml

In command prompt, you'd then run the java app like this... Let's assume you want external access on port 80 and your standard debug environment runs on port 1088...

java -jar tunnel.jar 80 localhost 1088

(Also answered here: Accessing asp. net development server external to VM)

Community
  • 1
  • 1
strongriley
  • 1,093
  • 1
  • 15
  • 12
  • 9
    +1 I think this answer is much more useful, since it allows you to debug a request coming from an external machine. Personally, I use this tunnel software: http://www.pocketsoap.com/tcpTrace/ – jwd Dec 12 '11 at 23:58
  • 3
    Good suggestion! The Java TCP tunnel is super slow, so maybe the pocketsoap one is a better choice. – strongriley Dec 13 '11 at 15:40
  • 3
    I think is should be marked as the best answer. This is the most non-intrusive way of getting things to work. Plus, you also get to watch the data packets. – Peter Jan 11 '12 at 05:00
  • 1
    It works like a charm. I have tested RINETD but it doesn't work with me. strongriley, Thanks a lot. – embarus Jul 19 '12 at 06:50
  • 1
    I tried this solution but it seems that it only works on 1 network card. I have 2 network cards, and I wanted to tested on my second card (different networks) and it failed. I went with a Wamp Server with a Proxy module in the end – Julien Pierre Oct 10 '12 at 04:49
  • 4
    Don't waste your time with java! Just use fiddler: http://fiddler2.com/documentation/Configure-Fiddler/Tasks/UseFiddlerAsReverseProxy – jaminto Jul 20 '13 at 13:04
  • 2
    Unfortunately your link is dead. I'm trying to access my running VS server from another machine on the same LAN, any ideas? – JaKXz Feb 10 '15 at 16:25
  • TcPTrace did not work for me, Casini continued to reject the connection. Fiddler reverse proxy did work. – Mauricio Aviles Aug 25 '16 at 17:16
20

No, you can't. It's set up so it only works on localhost, and I couldn't find any workarounds to make it work.

But, here's what I've been doing - I created the website on a specific port in IIS and opened that port up so it's visible on the network. I pointed that IIS website to my website's root folder (the one with web.config in it). Then I continued to use the ASP.NET Development server on that local machine while developing - both IIS and the ASP.NET Development Server can access the files at the same time (unless you're doing something wacky).

Let me know if there's a challenge with running IIS on your machine and I'll update my answer.

Jon Galloway
  • 52,327
  • 25
  • 125
  • 193
6

I realize this isn't a direct answer to your question, but an alternative to debugging using the ASP development server is to attach to the IIS process: How do I attach the debugger to IIS instead of ASP.NET Development Server?

Community
  • 1
  • 1
Pete Hodgson
  • 15,644
  • 5
  • 38
  • 46
5

Nope, stupidly (IMHO) there's no way to get the default ASP.net development server to serve pages to IPs other than localhost. What I did was to use UltiDev Cassini which is very quick to set up and is basically a version of the ASP.net development server compiled by UltiDev, and it will serve pages to any IP address.

Jez
  • 27,951
  • 32
  • 136
  • 233
4

Just for those who don't want/cant set up IIS for whatever reason...

Use fiddler or similar on your host - set your browser on the client VM to use the proxy then just use localhost:dev_port as usual on the client.

All requests from the client goto the proxy on your dev machine which routes to localhost on the dev machine and the ASP.net dev server thinks the request is from your dev machine!

deive
  • 862
  • 7
  • 19
3

You can recompile Cassini to get it to work - there's a fairly easy to remove check for localhost in there. Or, I'm pretty sure Ultidev's Cassini doesn't have this restriction. Both of these are easier to setup than IIS.

But, yeah, the builtin WebDev.WebServer doesn't work....Hmm, unless you run something like AnalogX's Proxy on your dev box and point it to the WebDev port. That should work (though I haven't tried it, it should take < 2 mins to setup).

Mark Brackett
  • 84,552
  • 17
  • 108
  • 152
3

You can use Cassini to expose your web apps externally. You just need to proxy the connection. I wrote a simple program to do this that you can run in another VS instance. Just change the port to match the port Cassini is using.

https://gist.github.com/945649

koush
  • 2,972
  • 28
  • 31
2

You can do port redirection using SOAP Toolkit 3.0

Once installed, go to My Programs > Microsoft Soap Toolkit 3 > Trace Utility

Once Trace Utility opened, go to File > New > Formatted Trace

In the dialog insert your ASP .NET Development Server port in Forward To Destination Port field.

It's only a workaround for testing purposes

  • Can you please give more information? I did exactly as you suggested, now what do i do? going to 10.0.0.3:8080 from an intranet comp did not work – Guy Apr 24 '12 at 14:13
1

Compile all you website in Debug mode, then create the website and publish it in IIS (make sure you can view it from other machine). Then attach the VS2010 Debugger to the process with the AppPool of your website (the process is called w3wp.exe when IIS>v5 and aspnet_wp.exe when IIS<5).

If you make some changes, just replace the package contents on the physical path of the website, and there you go again.

Tiborg
  • 2,304
  • 2
  • 26
  • 33
gvelasquez85
  • 511
  • 4
  • 3
  • No need to apologize for posting a late answer, that's what this site is all about! However, I do not see how your answer relates to the question at hand. The point of this question is specifically about how to use the development server -- i.e. how **not** to use IIS. – Kirk Woll May 18 '12 at 17:08
  • What I'm trying to point here is one way to debug an ASP application using the real IIS... you can't mimic the true behavior of a web application in the development server... but if you use the full IIS, you can send things to the server, mimic post and get, and so on... that's my point and I think this answer fits here... as an alternative way to "debug ASP app" – gvelasquez85 May 28 '12 at 19:43
1

I believe the built in ASP.NET server only works on localhost. You'll have to use IIS.

Jason
  • 86,222
  • 15
  • 131
  • 146