简体   繁体   English

我是否必须手动编辑 applicationhost.config 以将特定绑定添加到 IIS Express

[英]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.

相关问题 初始化 applicationhost.config 文件失败。 找不到 IIS Express - Initializing the applicationhost.config file failed. Cannot find IIS Express Applicationhost.config未更新 - Applicationhost.config not updated IIS CLI为我的项目生成带有site的applicationhost.config - IIS CLI generate applicationhost.config with site for my project 如何将IIS ApplicationHost.config文件解析为.Net对象? - How to parse the IIS ApplicationHost.config file into .Net objects? 以编程方式解锁applicationHost.config中的部分 - Unlock section in applicationHost.config programmatically applicationHost.config 错误:由于 IIS 共享配置的权限不足,无法写入配置文件 - applicationHost.config Error: Cannot write configuration file due to insufficient permissions with IIS shared configuration applicationhost.config中的位置路径未映射到程序集 - Location path in applicationhost.config not mapping to assembly C# applicationHost.config 未找到但存在 - C# applicationHost.config not found but exists Microsoft.Web.Administration-ApplicationHost.Config中带有httpError的NullReferenceException - Microsoft.Web.Administration - NullReferenceException with httpErrors in ApplicationHost.Config 由于applicationHost.config无效,.Net构建失败 - .Net build is failing due to invalid applicationHost.config
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM