简体   繁体   中英

how to get Application_Start (in Global.asax.cs) to be called before requests in asmx web service on IIS 6.0

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM