有没有办法远程调用 ASP.NET 开发 Web 服务器?

发布于 2024-07-15 08:31:58 字数 483 浏览 12 评论 0原文

知道一般来说,这是不可能的,那就是让另一台PC远程调用ASP.NET DEvelopment Web Server下托管的站点(一般只能使用localhost:port来访问它) )。

但我想知道是否有人见过或知道绕过它的方法? 我是办公室的 RESTful API 开发人员,我希望 PHP 人员在我的机器上测试 API,以便我可以附加 Visual Studio 2005 调试器,并且可以更轻松地发现问题。

主要问题是,我的机器是 Vista 机器,不幸的是,我开发的 API 无法在 IIS7 下工作,甚至经典应用程序池模式(这消除了将它们托管在本地 IIS 上的可能性)。

或者,有没有办法在另一台计算机上使用 IIS6 来满足我的需求?

更新

根据我得到的建议,经过多次尝试和错误,我能够让 Squid 充当反向代理并完全执行我想做的事情。 我已经在博客上介绍了它

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

凉城 2024-07-22 08:31:58

这比 Squid 选项要容易得多:

"从 iPhone 访问 Visual Studio ASP.NET 开发服务器"

还有一个在 Windows 7 下也能正常运行的更新:

"iPhone 访问 Visual Studio ASP。 NET 开发服务器 - Windows 7 更新”

This is substantially easier than the Squid option:

"Accessing the Visual Studio ASP.NET Development Server from iPhone"

Also there is an update that works well under Windows 7, too:

"iPhone Accessing the Visual Studio ASP.NET Development Server - Windows 7 Update"

ㄟ。诗瑗 2024-07-22 08:31:58

我刚刚尝试过 http://code.activestate.com/recipes/483732-异步端口转发/ 成功。 这是一个仅转发流量的 Python 脚本。

假设您的开发服务器运行的计算机是 192.168.42.42 并且开发服务器位于端口 12345 上,请使用命令行参数

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

From 运行脚本(在同一台计算机上)在另一台机器上,您可以通过 http://192.168.42.42:8000 访问服务器。

请务必更改 sender.handle_close,如 Dwight Walker 在评论中所述:

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

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()
一梦浮鱼 2024-07-22 08:31:58

你不能在 经典应用程序池模式

开发Web服务器严格限于本地主机,您要么需要反编译并重新编译它,要么在您的计算机上设置某种代理。

还有一个不相关的主题:尽管 Win2003 Server SP2 R2 应该支持到 2012 年 3 月,但也许应该将 IIS7 支持添加到您的应用程序中,以确保您也可以在 2008 Server 上运行。

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.

萌无敌 2024-07-22 08:31:58

基本上我花了 5 个小时来完成这项工作,最终如果你想要 5 分钟修复这里:

1. Port forward incoming traffic to your local ip on your network
TCP Any -> 3127-3128
TCP Any -> 80-81
TCP Any -> 8080
TCP Any -> 8000
TCP Any -> 8888
to
192.1681.1.3 (the local ip of the machine running .NET Dev server.)

2. Download SPI Port Forward

3. Heres the tricky part - Setup 2 forwarding rules as follows:
Local port: 8080 Remote: localhost Remote port 8080
Local port: 8080 Remote: localhost Remote port: .NET Dev server port

Without that second rule the .NET dev server wont serve the page

4. now visit your public IP address at port 8080 -- and you got it

Z

Basically i spent 5 hours making this work, and ultimately if you want a 5 min fix here goes:

1. Port forward incoming traffic to your local ip on your network
TCP Any -> 3127-3128
TCP Any -> 80-81
TCP Any -> 8080
TCP Any -> 8000
TCP Any -> 8888
to
192.1681.1.3 (the local ip of the machine running .NET Dev server.)

2. Download SPI Port Forward

3. Heres the tricky part - Setup 2 forwarding rules as follows:
Local port: 8080 Remote: localhost Remote port 8080
Local port: 8080 Remote: localhost Remote port: .NET Dev server port

Without that second rule the .NET dev server wont serve the page

4. now visit your public IP address at port 8080 -- and you got it

Z

罪歌 2024-07-22 08:31:58

您可能想查看 UltiDev 版本的 Cassini Web 服务器。 他们采用了 Microsoft 开源 Cassini Web 服务器并对其进行了增强,以允许远程连接等功能。

您可以将 VS 附加到该进程,并观察从 PHP 应用程序调用 RESTful API,正如您上面所描述的那样。

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.

白芷 2024-07-22 08:31:58

只需使用简单的 Java TCP 隧道即可。 下载这个 Java 应用程序 只需将流量引回即可。 无需搞乱 IIS!

http://jcbserver.uwaterloo.ca/cs436/software/tgui/tcpTunnelGUI.shtml

在命令提示符下,您可以像这样运行 java 应用程序...假设您希望在端口 80 上进行外部访问,并且标准调试环境在端口 1088 上运行...

java -jartunnel.jar 80 localhost 1088
(也在这里回答:访问虚拟机外部的asp.net开发服务器)

Just use a simple Java TCP tunnel. Download this Java app & just tunnel the traffic back. No messing with IIS necessary!

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)

娜些时光,永不杰束 2024-07-22 08:31:58

将 IIS 7 切换到经典管道无法解决兼容性问题?
与之前的许多版本一样,VS 2005 有一个远程调试器。

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

满栀 2024-07-22 08:31:58

就在这里! :D

我也一直在寻找克服这个限制的方法,并且意外地发现了以下文章:

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

我自己还没有尝试过,但看起来快速& 简单(尽管有些人可能会说这是硬核)。
顺便提一句。 我建议您查看 Erich Eichinger 的博客 上的其他一些帖子,因为其中有更多真正有价值的内容。

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.

瞄了个咪的 2024-07-22 08:31:58

这篇文章帮助了我:
http://staticvoidmain.cognitioab.se/index.php/2013/01/remote-debugging-asp-net-development-server-with-spi-port-forward/
它建议在开发人员计算机上使用第三方应用程序作为代理(某种程度)。 因此,您连接到此应用程序,它会将您的所有请求转发到开发服务器。 就像魔术一样工作:)

This post helped me:
http://staticvoidmain.cognitioab.se/index.php/2013/01/remote-debugging-asp-net-development-server-with-spi-port-forward/
It suggests using a third-party application on your developer machine to act as a proxy (sort of). So you connect to this app, and it forwards all your requests to the development server. Works like magic :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文