[英]Visual Studio 2017 - Giving remote users access to website in IIS Express
Been looking through and trying all guides i found on this topic but no luck.一直在浏览并尝试我在这个主题上找到的所有指南,但没有运气。 I am running and MVC project with HTTPS and want to access the debug site with some remote mobile devices to test out the website.我正在使用 HTTPS 运行 MVC 项目,并希望使用一些远程移动设备访问调试站点以测试该网站。 I followed a guide that almost work and i think I am pretty close to getting it to work.我遵循了一个几乎有效的指南,我认为我已经很接近让它发挥作用了。 Here are the steps I have done:以下是我所做的步骤:
-edit it to get this result: - 编辑它以获得这个结果:
netsh http add urlacl url=http://*:44363/ user=everyone - URL reservation successfully added netsh http add urlacl url=http://*:44363/ user=everyone - URL预留成功添加
-Tried to start Visual studio as admin and non admin. - 尝试以管理员和非管理员身份启动 Visual Studio。 Gets the following error message得到以下错误信息
"Unable to launch the IIS Express Web Server. Failed to reister URL " https://localhost:44363 " for site "x" Application. Error description: Cannot create file when that file already exists" “无法启动 IIS Express Web 服务器。无法为站点“x”应用程序重新注册 URL“ https://localhost:44363 ”。错误描述:该文件已存在时无法创建文件
-I then have to run cmd again and remove the url with the command: netsh http delete urlacl url=http://*:44363/ - 然后我必须再次运行 cmd 并使用以下命令删除 url:netsh http delete urlacl url=http://*:44363/
How do i get this to work with Visual Studio 2017 ?我如何让它与 Visual Studio 2017 一起使用? I cant be many steps from getting it to work.我不能让它开始工作很多步骤。 I have read many guides but none of them works我已经阅读了很多指南,但没有一个有效
Amazing how such a simple common need can be so painful to fulfill out of the box in 2017!令人惊讶的是,如此简单的共同需求在 2017 年开箱即用会如此痛苦!
Anyway https://github.com/icflorescu/iisexpress-proxy worked nicely for me.无论如何https://github.com/icflorescu/iisexpress-proxy对我来说效果很好。
Install it with node:使用节点安装它:
npm install -g iisexpress-proxy
Then its just something like:然后它就像:
iisexpress-proxy 51123 to 3000
Under 2 mins to get running.不到 2 分钟即可开始跑步。
Let me share my experience with Visual Studio and IIS Express that should help you.让我分享一下我使用 Visual Studio 和 IIS Express 的经验,应该会对您有所帮助。 I am not using HTTPS and my project type is Web site with WCF but you should be able to accomplish your goal.我没有使用 HTTPS,我的项目类型是带有 WCF 的网站,但您应该能够实现您的目标。 Here are prerequisites:以下是先决条件:
Now let us setup a project in VS.现在让我们在 VS 中设置一个项目。 I am using one of predefined templates with C#.我在 C# 中使用预定义模板之一。 Compile it and try to run it from VS.编译它并尝试从 VS 运行它。 At that moment VS is starting developer instance of IISExpress that helps your site to run.那时 VS 正在启动 IISExpress 的开发人员实例,以帮助您的站点运行。 You should be able to see IIS Express icon in Notification area.您应该能够在通知区域中看到 IIS Express 图标。 With right click you will see that your site is running and a port (we will call it VSPORT) that is assigned by VS.右键单击您将看到您的站点正在运行以及一个由 VS 分配的端口(我们称之为 VSPORT)。 This port must be different than reserved port (50001).此端口必须不同于保留端口 (50001)。 If you managed to accomplish this without problems then you have almost everything ready for running your site without VS.如果您成功地做到了这一点,那么您几乎已经准备好在没有 VS 的情况下运行您的网站。
Now we need to add this info in "global" IIS Express config.现在我们需要在“全局”IIS Express 配置中添加此信息。
binding protocol="http" bindingInformation="*:VSPORT:localhost"绑定协议="http" bindingInformation="*:VSPORT:localhost"
to到
binding protocol="http" bindingInformation=" :50001: "绑定协议="http" bindingInformation=" :50001: "
With this change you may start IISExpress.exe directly and you can continue to use VS to work on you project at the same time.通过此更改,您可以直接启动 IISExpress.exe,同时您可以继续使用 VS 处理您的项目。
If you want to access it from other computers do it as http://YOURIP:50001/ .如果您想从其他计算机访问它,请使用http://YOURIP:50001/ 。 Do have in mind that you need to ensure that your javascript code is NOT using address and port number directly.请记住,您需要确保您的 javascript 代码没有直接使用地址和端口号。
You can solve the problem by downloading the 'conveyor' library from extensions and update in Visual Studio.您可以通过从扩展中下载“传送带”库并在 Visual Studio 中更新来解决该问题。
You can access it from other devices.您可以从其他设备访问它。
Open Visual Studio打开 Visual Studio
Tools > Extensions and Updates工具 > 扩展和更新
Online > Visual Studio Marketplace在线 > Visual Studio 市场
When you launch the API, you can access it from other devices.当您启动 API 时,您可以从其他设备访问它。 This plugin creates a link from your own ip address.这个插件从你自己的 IP 地址创建一个链接。
Example: https://youripadress:5000/api/values示例: https://youripadress:5000/api/values
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.