如何在 IIS 6.0 上的 asmx Web 服务中的请求之前调用 Application_Start(在 Global.asax.cs 中)

发布于 2024-08-18 02:25:16 字数 351 浏览 0 评论 0原文

在我的 ASMX WS 中,当第一个请求到达时,将调用 Application_Start 。那时对我来说有点太晚了。有没有办法在 iisreset 完成后调用它?

什么是在 asmx Web 服务中为数据库 IO 生成线程的正确方法吗? 我询问了有关预加载系统数据的问题,这些人建议我在 Application_Start 中进行加载。但是,如果仅在第一次请求时完成,则结果是相同的,因此建议根本没有用。

in my ASMX WS Application_Start is called when 1st request arrives. It's kind of too late then for me. Is there any way to get it called when iisreset is done?

In what is the right way to spawn thread for database IO in asmx web service? I asked about preloading system data and the guys advised me to make load in Application_Start. However if it's done only on 1st request, it's the same and thus the advise of no use at all.

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

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

发布评论

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

评论(2

月下凄凉 2024-08-25 02:25:16

如果您拥有最新的 IIS 7.5,您可能需要查看应用程序初始化 这是最近添加的。我个人没有使用过它,但看起来它可能有你需要的一些东西。

概述

IIS 7.5 Beta 1 的 IIS 应用程序预热使 IT 专业人员能够在第一个请求到达之前加载 Web 应用程序,从而提高其网站的响应能力。通过主动加载和初始化所有依赖项(例如数据库连接、ASP.NET 代码编译和模块加载),IT 专业人员可以确保他们的网站始终响应,即使他们的网站使用自定义请求管道或者如果应用程序池被回收。

好处:

通过预加载工作进程来减少首次请求的响应时间
IIS 应用程序预热允许 IT 专业人员将 Web 应用程序配置为在第一个请求到达之前在 Web 服务器启动时预加载。通过预加载应用程序,工作进程能够减少响应第一个 Web 请求所需的时间。当请求到达服务器时,数据库连接、.NET Framework 等依赖项的加载和初始化以及 ASP.NET 应用程序和依赖项的即时编译都已完成。

发生重叠回收时通过预加载工作进程来提高可靠性
预加载依赖项还可以减少重叠回收场景中第一个请求的响应时间。回收的工作进程只会传达其准备情况,并在完成加载和初始化配置指定的资源后开始接受请求。

自定义应用程序的预加载
可以将 IIS 应用程序预热配置为使用特定网页和用户标识来初始化 Web 应用程序。这使得创建特定的初始化过程成为可能,这些过程可以根据初始化逻辑同步或异步执行。此外,这些过程可以使用特定的身份来确保正确的初始化。

If you have the newest, latest IIS 7.5, you might want to check out the Application Initialization that was just recently added. I personally haven't used it, but it looks like it might have some of the things you need.

Overview

IIS Application Warm-Up for IIS 7.5 Beta 1 enables IT Professionals to improve the responsiveness of their Web sites by loading the Web applications before the first requests arrive. By proactively loading and initializing all the dependencies such as database connections, compilation of ASP.NET code, and loading of modules, IT Professionals can ensure their Web sites are responsive at all times even if their Web sites use a custom request pipeline or if the Application Pool is recycled.

Benefits:

Decrease the response time for first requests by pre-loading worker processes
IIS Application Warm-Up allows IT Professionals to configure the Web application to be pre-loaded at the start of the Web server before the first request arrives. By pre-loading the application, the worker process is able to reduce the time it takes to respond to the first Web request. The loading and initialization of the dependencies such as database connections, .NET Framework, and the just-in-time compilation for ASP.NET applications and dependencies have already been performed by the time the request arrives to the server.

Increase reliability by pre-loading worker processes when Overlapped Recycling occurs
The response times for the first requests in an Overlapped Recycling scenario are reduced by also pre-loading dependencies. The recycled worker process will only communicate its readiness and will start accepting requests after it finishes loading and initializing the resources as specified by the configuration.

Customize the pre-loading of applications
IIS Application Warm-Up can be configured to initialize Web applications by using specific Web pages and user identities. This makes it possible to create specific initialization processes that can be executed synchronously or asynchronously depending on the initialization logic. In addition, these procedures can use specific identities in order to ensure a proper initialization.

你曾走过我的故事 2024-08-25 02:25:16

您可以创建一个简单的程序来向您的 Web 服务发出虚拟请求。这将第一次触发 Application_Start

将这个简单的程序作为计划任务运行,在计算机启动时运行。

You can create a simple program to make a dummy request to your web service. This will trigger Application_Start the first time.

Run this simple program as a scheduled task, running when the computer starts.

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