Is it possible to start I开发者_Python百科IS Express from the command line using the /path argument and include an HTTPS binding?
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.
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
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" />
Now from the IIS Express installation folder, run
iisexpress.exe /path:"<path-to-your-web-application>" /port:<HTTPS-port-configured-in-step-1>
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.
精彩评论