visual-studio 在本地网络中使用 Visual Studio Web 服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3965511/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:37:43  来源:igfitidea点击:

Use Visual Studio web server in local network

visual-studiowebserver

提问by Rana

Is there a way to access visual studio web server from another computer that share the same router? I tried connecting to the IP address but it didnt work. Is there a setting in VS? or firewall?

有没有办法从共享同一路由器的另一台计算机访问 Visual Studio Web 服务器?我尝试连接到 IP 地址,但没有成功。VS里有设置吗?或防火墙?

回答by Anish

You can achieve this by installing IIS Express. Go to

您可以通过安装 IIS Express 来实现这一点。去

http://www.microsoft.com/en-us/download/details.aspx?id=1038

http://www.microsoft.com/en-us/download/details.aspx?id=1038

Once installed, change your project setting to this: Project Settings

安装后,将您的项目设置更改为: 项目设置

Then go to

然后去

%userprofile%\Documents\IISExpress\config\applicationhost.config

%userprofile%\Documents\IISExpress\config\applicationhost.config

and for the project change the binding to this:

对于项目,将绑定更改为:

   <bindings>
      <binding protocol="http" bindingInformation=":54715:" />
   </bindings>

Note, you can also specify the bindings like this if you just want to limit it to your IP and machine name:

请注意,如果您只想将其限制为您的 IP 和机器名称,您也可以像这样指定绑定:

<binding protocol="http" bindingInformation="*:54715:localhost" />
<binding protocol="http" bindingInformation="*:54715:anishaalaptop" />

I debug my app over Wifi using my android app so I leave the binding open.

我使用我的 android 应用程序通过 Wifi 调试我的应用程序,因此我将绑定保持打开状态。

回答by Cam

I assume you mean the cassini web server built into visual studio. In short, no you can't. That cassini web server can only be accessed from the local computer.

我假设您的意思是 Visual Studio 中内置的 cassini Web 服务器。简而言之,不,你不能。该卡西尼网络服务器只能从本地计算机访问。

I found some further information. According to MSDN, you can't access it from another machine. What are some known functionality limitations of the Cassini Web server?

我找到了一些进一步的信息。根据 MSDN,您无法从另一台机器访问它。Cassini Web 服务器有哪些已知的功能限制?

It can host only one ASP.NET application per port.
It does not support HTTPS.
It does not support authentication.
It responds only to localhost requests.

每个端口只能承载一个 ASP.NET 应用程序。
它不支持 HTTPS。
它不支持身份验证。
它只响应本地主机请求。

see this MSDN article http://support.microsoft.com/kb/893391

请参阅此 MSDN 文章http://support.microsoft.com/kb/893391