问题描述
我有一个Web API服务,该服务正在部署到各种环境中(使用Octopus Deploy).它应该在启动时执行各种任务,例如运行Entity Framework Code First所需的任何迁移脚本,以及由Hangfire管理的一些后台任务.麻烦的是,该网站仅在有人首次致电时才唤醒.我希望它在部署后立即运行.我可以通过将Web浏览器指向API主页来手动完成此操作,但这需要我记住要这样做,并且如果我要部署到多个触角,那将是主要的PITA.
I have a Web API service that I'm deploying to my various environments (using Octopus Deploy). It is supposed to do various tasks on startup, e.g. run any migration scripts required by Entity Framework Code First, and some background tasks managed by Hangfire. Trouble is, the web site only wakes up the first time someone makes a call to it. I want it to run as soon as I've deployed it. I could do it manually just by pointing a web browser at the API's home page, but that requires me to remember to do that, and if I'm deploying to multiple tentacles, that's a major PITA.
部署网站后,如何强制网站自动启动?
How can I force the web site to start up automatically, right after it's been deployed?
推荐答案
在控制面板中,打开或关闭Windows功能,在"Web服务器(IIS)| Web服务器|应用程序开发"下,选择应用程序初始化".
In the control panel under turn windows features on or off,Under "Web Server (IIS) | Web Server | Application Development",select "Application Initialization".
在IIS中,在应用程序池"的高级设置上,开始模式"应设置为始终运行".
In IIS, on the advanced settings for the Application Pool,"Start Mode" should be set to "AlwaysRunning".
在IIS中,该网站的高级设置上,已启用预加载"应设置为"true".
In IIS, on the advanced settings for the site,"Preload Enabled" should be set to "true".
新的部署将使其重新启动(可能在短暂的延迟之后).
A new deployment will cause it to start again (possibly after a short delay).
这篇关于部署后如何使IIS站点自动启动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!