开发者

Load file once into an ASP.NET application

开发者 https://www.devze.com 2023-03-31 04:12 出处:网络
I\'m working on a web based app which in the core is an expert system, and I need to load the rul开发者_C百科es file to the app only once .. so I need an equivalent to public static void main() {} in

I'm working on a web based app which in the core is an expert system, and I need to load the rul开发者_C百科es file to the app only once .. so I need an equivalent to public static void main() {} in ASP.NET site to load the file in it .. what is this equivalent and is it exist .. any suggestions are highly welcome


You're looking for the Application_Start event in Global.asax.cs.


This is done in (as @SLaks said) Application_Start. However - be very careful of doing any long operation here as you can run into problems. If this is a long operation, consider starting another thread or pre-processing this information into a table you can quickly load.


Auto-Start in ASP.NET 4 was built for this:

The new "auto start" feature of ASP.NET 4 and IIS 7.5 provides a well-defined approach that allows you to perform expensive application startup and pre-cache logic that can run before any end-users hit your application. This enables you to have your application "warmed up" and ready from the very beginning, and deliver a consistent high performance experience.

0

精彩评论

暂无评论...
验证码 换一张
取 消