[英]Must I manually edit the applicationhost.config to add specific bindings to IIS Express
I'm renovating an https asp.net site which renders using two different skins depending on the URL which the user visits.我正在翻新一个 https asp.net 站点,该站点根据用户访问的 URL 使用两种不同的外观进行呈现。 When we put the site live we can use the bindings in IIS Manager to set up specific bindings to cater for this.当我们将站点上线时,我们可以使用 IIS 管理器中的绑定来设置特定的绑定来满足这一点。 I'm using IIS Express in my development environment and can't see anywhere in Visual Studio to edit the bindings.我在我的开发环境中使用 IIS Express,在 Visual Studio 中看不到任何地方来编辑绑定。 So to get the functionality I want I am manually editing the applicationhost.config
and adding in the lines I need to make it work (the lines mentioning apples and oranges):所以为了获得我想要的功能,我手动编辑applicationhost.config
并添加我需要使其工作的行(提到苹果和橘子的行):
<site name="MySite.PresentationLayer" id="1">
<application path="/" applicationPool="MySiteAppPool">
<virtualDirectory path="/" physicalPath="E:\TFS\Dev\WebApps\MySite\Presentation" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:44301:localhost" />
<binding protocol="https" bindingInformation="*:44301:localhost" />
<binding protocol="https" bindingInformation="*:44435:apples-mysite" />
<binding protocol="https" bindingInformation="*:44436:oranges-mysite" />
</bindings>
</site>
Can I do this from within Visual Studio or is manually editing the applicationhost.config
the best way to do this?我可以在 Visual Studio 中执行此操作还是手动编辑applicationhost.config
是执行此操作的最佳方法?
Simple answer is yes, as things stand using Visual Studio 2017, you have to manually edit the applicationhost.config ($SolutionDir.vs\\config\\applicationHost.config) to set up the specific bindings to get the functionality described above out of IIS Express.简单的答案是肯定的,就使用 Visual Studio 2017 而言,您必须手动编辑 applicationhost.config ($SolutionDir.vs\\config\\applicationHost.config) 以设置特定绑定以从 IIS Express 中获取上述功能.
Jexusmanager mentioned in the comments above can manage this file as well as your actual IIS configs and may be worth checking out if you've ended up here.上面评论中提到的 Jexusmanager 可以管理这个文件以及你的实际 IIS 配置,如果你已经到了这里,可能值得一试。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.