脚本部分的又一篇:
IisExpressAdminCmd setupSslUrl -url:https://localhost:44308 -UseSelfSigned
appcmd add site /name:"MySite" /bindings:https/*:44308:localhost /physicalPath:"C:\MySite"
iisexpress /site:MySite
这些命令在C:\Program Files (x86)\IIS Express\
目录中。
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>
我也曾遇到过这个问题。虽然不是你所期望的完美解决方案,但你可以通过命令行向默认的iisexpress配置中添加一个新站点:
APPCMD add site /name:MyNewSite /bindings:"http/*:81:" /physicalPath:"C:\MyNewSite"