如何在IIS Express中启用远程请求?Scott Guthrie写道,这是可能的,但他没有说明如何实现。
当前回答
这是非常棒的,甚至包括HTTPS的漂亮域名:
http://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx
非常棒的部分,我在其他地方找不到,以防上面的链接消失:
> C:\Program Files (x86)\IIS Express>IisExpressAdminCmd.exe Usage:
> iisexpressadmincmd.exe <command> <parameters> Supported commands:
> setupFriendlyHostnameUrl -url:<url>
> deleteFriendlyHostnameUrl -url:<url>
> setupUrl -url:<url>
> deleteUrl -url:<url>
> setupSslUrl -url:<url> -CertHash:<value>
> setupSslUrl -url:<url> -UseSelfSigned
> deleteSslUrl -url:<url>
>
> Examples: 1) Configure "http.sys" and "hosts" file for friendly
> hostname "contoso": iisexpressadmincmd setupFriendlyHostnameUrl
> -url:http://contoso:80/ 2) Remove "http.sys" configuration and "hosts" file entry for the friendly hostname "contoso": iisexpressadmincmd
> deleteFriendlyHostnameUrl -url:http://contoso:80/
上面的实用程序将为您注册SSL证书!如果你使用-UseSelfSigned选项,这非常简单。
如果你想用困难的方式做事,不明显的部分是你需要告诉HTTP。SYS使用什么证书,像这样:
netsh http add sslcert ipport=0.0.0.0:443 appid={214124cd-d05b-4309-9af9-9caa44b2b74a} certhash=YOURCERTHASHHERE
Certhash是您可以从MMC中的证书属性中获得的“Thumbprint”。
其他回答
一个很好的资源是Scott Hanselman的IISExpress更容易在开发阶段使用SSL。
您要了解的是如何让IIS Express通过端口80为外部提供服务
帮助我的是右键单击“IISExpress”图标,“显示所有应用程序”。然后选择网站,我看到哪个应用程序主机。它使用的配置,纠正进行得很完美。
您可能需要做三个更改。
告诉IIS Express本身绑定到所有ip地址和主机名。在你的。config文件中。通常: VS 2015: $ (solutionDir) \ .vs \ config \ applicationhost.config < VS 2015: %userprofile%\My Documents\IISExpress\config\applicationhost.config
找到站点的绑定元素,然后添加
<binding protocol="http" bindingInformation="*:8080:*" />
设置Windows中名为“http.sys”的部分。以管理员身份执行如下命令:
netsh http add urlacl url=http://*:8080/ user=everyone
每个人都是一个windows组。对于有空格的组使用双引号,如“Tout le monde”。
允许IIS Express通过Windows防火墙。 启动/ Windows防火墙高级安全/入站规则/新规则… 程序%ProgramFiles%\IIS Express\iisexpress.exe 或端口8080 TCP
现在,当您启动iisexpress.exe时,您应该看到如下消息
成功注册网址“http://*:8080/”网站“hello world”应用程序“/”
如果你从管理员运行Visual Studio,你可以添加
<装订协议=“http”bindingInformation=“8080:*”/>
or
<装订协议=“https”binps条=“*:8443:*”/>
into
%userprofile%\My Documents\IISExpress\config\applicationhost.config
顺便说一句:
netsh http add urlacl url=http://vaidesg:8080/ user=everyone
这只适用于英文版的Windows。如果你正在使用本地化版本,你必须用其他东西替换“everyone”,例如:
在使用荷兰语版本时是“Iedereen” 使用德语版本时使用“Jeder” 当使用匈牙利语版本时,“Mindenki”
否则你会得到一个错误(创建SDDL失败,错误:1332)
推荐文章
- 实体框架核心:在上一个操作完成之前,在此上下文中开始的第二个操作
- 如何为构造函数定制Visual Studio的私有字段生成快捷方式?
- 如何使用JSON确保字符串是有效的JSON。网
- AppSettings从.config文件中获取值
- 通过HttpClient向REST API发布一个空体
- 如何检查IEnumerable是否为空或空?
- 自动化invokerrequired代码模式
- 在c#代码中设置WPF文本框的背景颜色
- 在c#中,什么是单子?
- c#和Java中的泛型有什么不同?和模板在c++ ?
- c#线程安全快速(est)计数器
- 如何将此foreach代码转换为Parallel.ForEach?
- 如何分裂()一个分隔字符串到一个列表<字符串>
- 如何转换列表<字符串>列表<int>?
- c#对象列表,我如何得到一个属性的和