我有一些逻辑要在Application_Start中执行,但是不必将其添加到Global.asax.cs的Application_Start中,我可以在其中添加一个条目到web.config中以完全执行它Application_Start?
Specifically from the web.config, you could create a HTTP Module that would hook into the start of the application.
Also depending on your setup, you could use the WebActivator ( Nuget ) which would allow you to hook into the Application_Start event at runtime.
您也许可以在app_start中创建一个初始化程序,该初始化程序查看Web配置并加载要启动的各种任务
there are different ways of doing that, one simple way is
Or you can use some other technology like dependency injection and inject the actual implementation from the web.config
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.