Ted*_*Tel 448 c# asp.net iis-express
如何在IIS Express中启用远程请求?斯科特格思里写道,这是可能的,但他没有说明如何.
Dam*_*rds 394
IIS团队网站上有一篇博客文章,现在解释如何在IIS Express上启用远程连接.以下是该帖子的相关部分:
在Vista和Win7上,从管理提示符运行以下命令:
netsh http add urlacl url=http://vaidesg:8080/ user=everyone
对于XP,首先安装Windows XP Service Pack 2支持工具.然后从管理提示符运行以下命令:
httpcfg set urlacl /u http://vaidesg1:8080/ /a D:(A;;GX;;;WD)
Col*_*nic 342
您可能需要进行三项更改.
.config
文件中.典型:
$(solutionDir)\.vs\config\applicationhost.config
%userprofile%\My Documents\IISExpress\config\applicationhost.config
找到您网站的绑定元素,然后添加
<binding protocol="http" bindingInformation="*:8080:*" />
Run Code Online (Sandbox Code Playgroud)
netsh http add urlacl url=http://*:8080/ user=everyone
Run Code Online (Sandbox Code Playgroud)
everyone
Windows组在哪里.对于包含"Tout le monde"等空格的组,请使用双引号.
允许IIS Express通过Windows防火墙.
具有高级安全性/入站规则/新规则的启动/ Windows防火墙...
程序
%ProgramFiles%\IIS Express\iisexpress.exe
或端口8080 TCP
现在,当你开始时,iisexpress.exe
你应该看到一条消息,如
已成功为网站"hello world"应用程序"/"注册URL"http://*:8080 /"
Ion*_*scu 121
我记得几个月前尝试这个工作流时遇到了同样的问题.
这就是为什么我专门针对这种情况编写了一个简单的代理实用程序:https://github.com/icflorescu/iisexpress-proxy.
使用IIS Express代理,一切都变得非常简单 - 不需要"netsh http add urlacl url = vaidesg:8080/user = everyone"或者搞乱你的"applicationhost.config".
只需在命令提示符下发出:
iisexpress-proxy 8080 to 3000
...然后您可以将远程设备指向http:// vaidesg:3000.
大多数时候更简单的更好.
Too*_*kit 116
在我找到iisexpress-proxy之前,没有什么对我有用.
以管理员身份打开命令提示符,然后运行
npm install -g iisexpress-proxy
Run Code Online (Sandbox Code Playgroud)
然后
iisexpress-proxy 51123 to 81
Run Code Online (Sandbox Code Playgroud)
假设您的Visual Studio项目在localhost:51123上打开,并且您想要访问外部IP地址xxxx:81
编辑:我目前正在使用 ngrok
bre*_*eez 34
作为旁注:
netsh http add urlacl url=http://vaidesg:8080/ user=everyone
Run Code Online (Sandbox Code Playgroud)
这仅适用于Windows的英文版本.如果您使用的是本地化版本,则必须将"everyone"替换为其他内容,例如:
否则您将收到错误(创建SDDL失败,错误:1332)
Dan*_*ich 31
如果您正在使用Visual Studio,请按照以下步骤访问IP-Adress上的IIS-Express:
ipconfig
在Windows命令行中去
$(SolutionDir)\.vs\config\applicationHost.config
Run Code Online (Sandbox Code Playgroud)找
<site name="WebApplication3" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\user.name\Source\Repos\protoype-one\WebApplication3" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:62549:localhost" />
</bindings>
</site>
Run Code Online (Sandbox Code Playgroud)添加:
<binding protocol="http" bindingInformation="*:62549:192.168.178.108"/>
使用您的IP地址
小智 19
我在Visual Studio Professional 2015中安装了"Conveyor by Keyoti"解决了这个问题.传送带生成一个REMOTE地址(您的IP),其端口(45455)启用了外部请求.例:
Conveyor允许您从网络上的外部平板电脑和手机或Android模拟器测试Web应用程序(无http://10.0.2.2:<hostport>
)
步骤如下:
https://marketplace.visualstudio.com/items?itemName=vs-publisher-1448185.ConveyorbyKeyoti
Bru*_*uce 10
如果您尝试过Colonel Panic的答案但在Visual Studio中不起作用,请尝试以下操作:
<binding />
在IIS Express配置中添加另一个
<bindings>
<binding protocol="http" bindingInformation="*:8080:localhost" />
<binding protocol="http" bindingInformation="*:8080:hostname" />
</bindings>
Run Code Online (Sandbox Code Playgroud)
最后,您必须以管理员身份运行Visual Studio
这就是我使用Visual Studio 2015为Windows 10启用的远程访问,包括http和https:
第一步是将应用程序绑定到内部IP地址.运行cmd
- > ipconfig
获取地址.打开文件/{project folder}/.vs/config/applicationhost.config
并向下滚动,直到找到如下内容:
<site name="Project.Web" id="2">
<application path="/">
<virtualDirectory path="/" physicalPath="C:\Project\Project.Web" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:12345:localhost" />
</bindings>
</site>
Run Code Online (Sandbox Code Playgroud)
在下面添加两个新绑定bindings
.如果您愿意,也可以使用HTTPS:
<binding protocol="http" bindingInformation="*:12345:192.168.1.15" />
<binding protocol="https" bindingInformation="*:44300:192.168.1.15" />
Run Code Online (Sandbox Code Playgroud)
将以下规则添加到防火墙,cmd
以管理员身份打开新提示并运行以下命令:
netsh advfirewall firewall add rule name="IISExpressWeb" dir=in protocol=tcp localport=12345 profile=private remoteip=localsubnet action=allow
netsh advfirewall firewall add rule name="IISExpressWebHttps" dir=in protocol=tcp localport=44300 profile=private remoteip=localsubnet action=allow
Run Code Online (Sandbox Code Playgroud)
现在启动Visual Studio作为Administrator
.右键单击Web项目项目文件并选择Properties
.转到Web
选项卡,然后单击Create Virtual Directory
.如果Visual Studio未以管理员身份运行,则可能会失败.现在一切都应该有效.
是什么帮助我,是右键单击'IISExpress'图标,'显示所有应用程序'.然后选择网站,我看到它使用了哪个aplicationhost.config,并且纠正完美.
我发现的最简单和最酷的方法是使用(设置需要 2 分钟):
它适用于在本地主机上运行的任何内容。只需注册,运行很少的可执行文件,无论您在 localhost 上运行什么,都会获得可以从任何地方访问的公共 URL。
这非常适合向您的远程团队成员展示内容,无需摆弄 IIS 设置或防火墙。想要停止访问只是终止可执行文件。
ngrok authtoken xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
ngrok http -host-header=localhost 89230
Run Code Online (Sandbox Code Playgroud)
假设 89230 是您的 IIS Express 端口
即使在免费计划中,您也可以运行多个端口
结合此线程中的答案,这就是我修复它的方式(Visual Studio 2019):
以管理员身份启动 Visual Studio 并像往常一样运行 Web 服务。
在任务栏上找到 IIS Express 图标,右键单击它,然后单击“显示所有应用程序”。
选择您的 Web 服务并注意下面显示的配置路径。单击配置文件以打开它进行编辑。
在此配置文件中找到您的 Web 服务(例如搜索您的端口),然后找到如下一行:
*
: yourport :localhost
之后添加一个新行,如下所示:
:
你的端口:*
在这种情况下,无需创建具有特定 ip 地址的绑定,这些地址将来可能会更改。
我希望这可以帮助那里的人。
小智 5
您可以尝试设置端口转发,而不是试图修改IIS配置快递,添加新的HTTP.sys规则或运行Visual Studio作为一个管理员。
基本上你需要给转发IP:PORT
您的网站运行在你的机器上的一些其他自由港,但外部网络适配器上,而不是本地主机。
问题是,IIS快递(至少在Windows 10)的结合[::1]:port
意味着它侦听的IPv6端口。你需要考虑到这一点。
这里是我做这项工作- http://programmingflow.com/2017/02/25/iis-express-on-external-ip.html
希望能帮助到你。
归档时间: |
|
查看次数: |
305078 次 |
最近记录: |