views:

2167

answers:

7

I know that generally speaking, this cant be done, that is get another PC to call a site hosted under the ASP.NET DEvelopment Web Server remotely (generally you can only use localhost:port to get to it).

But I was wondering if anyone has seen, or knows of a way to get around it? I am a RESTful API developer in my office, and I would like the PHP guys to test the APIs on my machine so that I can have the Visual Studio 2005 debugger attached, and I can more easily find problems.

THe main issue is, that my machine is a Vista machine, and unfortunately, the APIs I have developed do not work under IIS7, even Classic Application Pool mode (which eliminates hosting them on a local IIS impossible).

Alternatively, is there a way to use IIS6 on another machine to suite my needs?

Update

Based on the advise that I have gotten and after much trial and error with the suggestions made, I was able to get Squid to act as a reverse-proxy and do exactly what I wanted to do. I have blogged about it http://www.ashleyangell.com/index.php/2009/03/configuring-a-basic-reverse-proxy-in-squid-on-windows-website-accelerator/ in case anyone else wants to do the same thing.

+2  A: 

You can debug remotely to a computer with IIS6. Check this blog post on how to set it up: http://blogs.iis.net/brian-murphy-booth/archive/2008/05/23/remoting-debugging-asp-net-applications-using-visual-studio-2008.aspx

Here is a link for vs2005: http://aspnet2holes.blogspot.com/2006/11/debug-aspnet-20-running-under-iis-60.html. I still recommend to check the 2008 one, just for some extra comments it has.

eglasius
This is for Visual Studio 2005...
Ash
@Ash added a link for vs 2005
eglasius
So this option isnt going to work becasue the code needs to be copied to the server hosting IIS. No to mention security issues with the office being on a domain.
Ash
+2  A: 

Can't you just run IIS7 in Classic Application Pool mode?

The Development Web Server is strictly limited to Localhost, you would either need to decompile and recompile it, or set up some kind of Proxy on your machine.

And on an unrelated Topic: Even though Win2003 Server SP2 R2 should be supported up to March 2012, maybe IIS7 Support should be added to your application to make sure you can run on 2008 Server as well.

Michael Stum
Already tried, and while the obvious limitations are not good, due to my employers restrictions, not possible at the moment. Eventually I hope to move to the ASP.NET MVC framework for my APIs (or even better, Ruby) but this is not possible - yet.
Ash
How do I setup a proxy for it? I assume it would require a reverse proxy, but how is that done?
Ash
Good question, never set one up myself (I only know that they do exist), but I saw an article about writing one (ironically one that runs on IIS): http://www.codeproject.com/KB/web-security/HTTPReverseProxy.aspx
Michael Stum
I am not sure a proxy would work, i.e. that the IP packets would arrive at a low enough level for the web server to appear local.
cdonner
Shouldn't proxies be transparent? It's been a while since I ran the Web Server through Reflector, but I think that the check is purely IP based, so I think this should work. But as said, never set one up myself, so that's just the Theory.
Michael Stum
A: 

Switching IIS 7 to Classic pipeline does not resolve your compatibility issues? VS 2005 has a remote debugger, as did many versions before that.

cdonner
I tried setting my project to "Use IIS Web server" but it wouldnt let me - telling me that the feature was only available on local IIS installations. :(
Ash
Is it possible to setup the project so it automatically deploys to that IIS machine? I have never done remote debugging before.
Ash
You need to install and run the remote debugger on the server, then connect using the "Attach to Process" feature in the VS Debug menu.
cdonner
If your project is a standard web site or web application, yes, you can deploy from Visual Studio to the server.
cdonner
+1  A: 

You might want to take a look at UltiDev's version of the Cassini web server. They took the Microsoft Open Source Cassini web server and enhanced it to allow among other things, remote connections.

You can attach VS to the process, and watch your RESTful APIs being called from the PHP application, exactly as you describe above.

Christopher_G_Lewis
I managed to get Cassini running my web application and its accessible to other PCs in the office, which exactly what I wanted, but I cannot get it to go into debug for the web application - the symbols wont load so I cant debug. I tried attaching to the process running the site but it wont let me.
Ash
A: 

YES THERE IS! :D

I was also looking around to overcome this limitation for some time and accidentally I stumbled upon following article:

http://eeichinger.blogspot.com/2009/12/sniff-http-traffic-with-aspnet.html

I haven't tried it myself yet, but looks quick & simple (although some may say this is hardcore).
BTW. I recommend you look at some other posts at Erich Eichinger's blog, since there's more really valuable stuff.

Piotr Owsiak
+2  A: 

This is substantially easier than the Squid option: http://www.pluralsight-training.net/community/blogs/jimw/archive/2009/09/03/accessing-the-visual-studio-asp-net-development-server-from-iphone.aspx

cottsak
Thank you so much, this works great.
wizlb
+2  A: 

I have just tried http://code.activestate.com/recipes/483732-asynchronous-port-forwarding/ successfully. It's a Python script that just forwards the traffic.

Assuming the machine your dev server runs on is 192.168.42.42 and the dev server is on port 12345, run the script (on the same machine) with the command line arguments

-l 192.168.42.42 -p 8000 -r 127.0.0.1 -P 12345

From a different machine, you can then access the server via http://192.168.42.42:8000.

Be sure to change sender.handle_close as noted by Dwight Walker in the comments:

def handle_close(self):
    self.close()
    if len(self.receiver.to_remote_buffer) == 0:
        self.receiver.close()
balpha