如何阻止IIS编译网站?

发布于 2024-08-23 22:54:44 字数 387 浏览 5 评论 0原文

我有一个 ASP .NET Web 应用程序,它在后端与 ASMX Web 服务通信。我们统计过,初始请求的平均等待时间是20s。我想知道是否有一种方法可以将 Web 服务发送到预编译的服务器,从而无需编译。

我们还注意到 IIS 倾向于回收其工作线程,这也会导致编译。该进程本身并不经常被访问,但访问时需要更快。

有什么想法吗?

提前致谢

更新:感谢所有建议,我已经尝试了其中的一些建议,这是我发现的。回收时间关闭/修补是危险的,因为我不希望线程只是无所事事。经过进一步检查,该网站正在预编译,所以我的问题是为什么 Web 服务有初始启动时间?

现在:倾向于下面的预热脚本建议

更新:该服务正在从另一台计算机上的 Web 服务器访问。我们仅发现初始请求存在问题。

I have an ASP .NET web application which on the backend is talking to an ASMX web service. We have counted and the average wait time for the initial request is 20s. I am wondering if there is a way I can send the web service up to the server precompiled, thus negating the need for compilation.

We have also noticed that IIS tends to recycle its worker threads and this also causes a compilation. The process itself is not accessed terribly often, but it needs to be much quicker when it is.

Any thoughts?

Thanks in advance

Update: thanks to all the suggestions, I have tried a number of them and here is what I have found. Recycle time shutdown/tinkering is dangerous cause I dont want threads to just sit around doing nothing. Upon further inspection the site is going up precompiled, so my question is why is there an initial spin up time for a web service?

Right now: Leaning towards the warmup script suggestion below

Update: The service is being hit from a web server on a different machine. We are seeing problems with the initial request only.

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

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

发布评论

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

评论(5

别靠近我心 2024-08-30 22:54:44

一种替代方法是编写一个“预热脚本”,它只需执行应用程序中的一个页面。这将使服务器为您启动,下一个人将获得快速命中。您还可以设置一个计划进程来偶尔运行该脚本(例如,如果您安排线程池在凌晨 4 点回收,则安排预热脚本在凌晨 4:01 运行)

One alternative approach is to write a "warm-up script" which simply executes one page from your app. This will make the server spin-up for you and the next person will get a fast hit. You could also set a scheduled process to run that script occasionally (like, if you schedule the thread pool to recycle at 4 am, schedule the warm-up script to run at 4:01 am)

回忆那么伤 2024-08-30 22:54:44

您应该寻求将预编译作为构建/部署脚本的一部分。

在我看来,进行部署后活动以编程方式请求每个 Web 资源并触发编译似乎相当愚蠢。

Thomas 的回答给了编译器,MSDN 上还有一个指南,如何:预编译 ASP.NET 网站

如果您使用的是 MSBuild,请执行 AspNetCompiler 任务

(我可能会对此发表评论,但我还没有被允许......没有足够的果汁)

You should be looking to perform precompliation as part of your build/deploy scripts.

Having a post-deployment activity to programatically request each web resource and trigger compliation seems pretty daft to me.

Thomas' answer gives the compiler, there's also a guide over at the MSDN, How to: Precompile ASP.NET Web Sites.

If you're using MSBuild then go for the AspNetCompiler Task.

(I probably would have made this a comment but I'm not yet allowed... not enough SO juice)

诺曦 2024-08-30 22:54:44

您是否尝试过在框架文件夹(例如%SYSTEMROOT%\ Microsoft.NET \ Framework \ v2.0.50727)中使用aspnet_compiler?

您可以通过应用程序池上的设置来控制 ASP.NET 回收。如果它的回收频率比设置更频繁,则可能是其他原因造成的(例如对 web.config 的更改等)

Have you tried using aspnet_compiler in the framework folder (e.g. %SYSTEMROOT%\Microsoft.NET\Framework\v2.0.50727)?

You can control ASP.NET recycling via the settings on the Application Pool. If it is recycling more often than the settings then something else is causing that (e.g. changes to the web.config etc.)

雨落星ぅ辰 2024-08-30 22:54:44

尝试在IIS的页面或应用程序池的配置中禁用应用程序回收。

IIS 6(如果我没记错的话):右键单击 AppPool ->选项卡“性能”->取消选中“空闲时间关闭工作进程”

IIS 7.5 有一个属性(似乎也是一个应用程序池设置)可以在 X 分钟的空闲时间后关闭应用程序池。值 0 等于“永不关闭”

希望这有帮助

Try to disable application recyling in the configuration of the page or application pool in the IIS.

IIS 6 (If i remember correctly): Rightclick on AppPool -> Tab "Performance" -> Uncheck "Shut down working process on idle time"

IIS 7.5 There is property (seems to be an appPool settings too) that shuts down the AppPool after X minutes of idling time. The value 0 is equal to "never shut down"

Hope this helps

合久必婚 2024-08-30 22:54:44

在之前的职位上,我们在最初假脱机时遇到了与 WCF 服务类似的问题,我们通过创建一个简单的程序来绕过这个问题,该程序将在部署后调用我们的所有 Web 服务。

您还可以使用相同类型的程序作为保持活动服务,并每隔 5-10 分钟 ping 一次服务,等等。

At a previous position we had similar issues with WCF services when initially spooling up we bypassed this by creating a simple program that would invoke all our web services after a deployment.

You could also use this same type of program as a keep alive service and just ping the services every 5-10 minutes etc.

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