jonnarosey
jonnarosey

Reputation: 560

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. When we put the site live we can use the bindings in IIS Manager to set up specific bindings to cater for this. I'm using IIS Express in my development environment and can't see anywhere in Visual Studio to edit the bindings. 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):

<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?

Upvotes: 0

Views: 2042

Answers (1)

jonnarosey
jonnarosey

Reputation: 560

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.

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.

Upvotes: 2

Related Questions