使用 HTTPS 从命令行使用 /path 启动 IIS Express?

发布于 2024-11-27 04:44:21 字数 54 浏览 1 评论 0原文

是否可以使用 /path 参数从命令行启动 IIS Express 并包含 HTTPS 绑定?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

无需解释 2024-12-04 04:44:21

脚本部分的另一部分:

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\ 目录中。

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.

星星的轨迹 2024-12-04 04:44:21
  1. 以下链接将帮助您配置 https 端口(尤其是从此链接阅读“制作 SSL 证书,将其连接到 IIS Express 并使其受信任”)
    https://www.hanselman.com/blog/WorkingWithSSLAtDevelopmentTimeIsEasierWithIISExpress.aspx

  2. 使用 /path 命令行选项时,IIS Express 使用位于 %programfiles%\IIS 中的模板 appliationhost.config 文件Express\AppServer(在 64 位计算机上 %programfiles(x86)%\IIS Express\AppServer)。编辑此配置文件中的绑定元素,如下所示(将协议更改为“https”)

    <绑定协议=“https”绑定信息=“:8080:localhost”/>
    
  3. 现在从 IIS Express 安装文件夹中运行 iisexpress.exe /path:"” /port:

  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>

物价感观 2024-12-04 04:44:21

我也为此苦苦挣扎。它不完全是您想要的原始解决方案,但您可以通过命令行将新站点添加到默认 iisexpress 配置:

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

您将希望将 appcmd.exe 定位到 c:\program files (x86)\iisexpress 中

添加后, 然后,您可以使用 iisexpress.exe 以传统方式启动 iisexpress,目标是您刚刚添加到配置中的站点。

通过 ADD、SET 和 DELETE 操作对象

您还需要“允许”iisexpress 提供 ssl 服务。

使用 IISExpress 在开发时使用 SSL 更容易

尽管如此,编写起来可能更容易/更干净您自己的自定义配置文件与您想要的绑定并使用它加载站点。这样可以更好地控制。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文