13

Is it possible to start IIS Express from the command line using the /path argument and include an HTTPS binding?

3 Answers 3

12

Another one for the scripts section:

IisExpressAdminCmd setupSslUrl -url:https://localhost:44308 -UseSelfSigned

appcmd add site /name:"MySite" /bindings:https/*:44308:localhost /physicalPath:"C:\MySite"

iisexpress /site:MySite

Those commands are in the C:\Program Files (x86)\IIS Express\ directory.

Sign up to request clarification or add additional context in comments.

1 Comment

This is great. What if you have multiple sites? How to start them in in the same pool?
5
  1. Following link would help you in configuring https port (especially read "Making an SSL Cert, hooking it up to IIS Express and making it Trusted" from this link ) https://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

  2. When /path command line option is used, IIS Express uses the template appliationhost.config file located in %programfiles%\IIS Express\AppServer (on 64-bit machine %programfiles(x86)%\IIS Express\AppServer). Edit binding element in this configuration file as shown below (change the protocol to 'https')

    <binding protocol="https" bindingInformation=":8080:localhost" />
    
  3. Now from the IIS Express installation folder, run iisexpress.exe /path:"<path-to-your-web-application>" /port:<HTTPS-port-configured-in-step-1>

3 Comments

Would this work for HTTP and HTTPS binding at the same time? Just add another <binding> node?
No. It does not work... Probably you should use /config command line switch.
Thanks but I'm trying to do it completely from the command link without editing the configuration. Sound like it can't be done.
2

I've struggle with this too. Its not quite the pristine solution you want but you can add a new site to the default iisexpress config via the command line:

APPCMD add site /name:MyNewSite /bindings:"http/*:81:" /physicalPath:"C:\MyNewSite"

You'll want to target the appcmd.exe in c:\program files (x86)\iis express

After adding it you can then launch iisexpress the conventional way using iisexpress.exe targeting the site you just added to the config.

Manipulating Objects with ADD, SET, and DELETE

You need to "allow" iisexpress to serve ssl as well.

Working with SSL at Development Time is easier with IISExpress

Still it's probably just easier/cleaner to write your own custom config file with the bindings you want and load the site using that. More control that way.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.