简体   繁体   中英

Assembly name for ASP.Net website project

I have Quartz.Net integrated for Scheduler job in my ASP.Net application.

But it is not working automatically and seems that it got stopped when IIS is recycling Application Pool. But fires when we send a request to server.

After reading IIS app pool recycle + quartz scheduling I am trying to configure the same in IIS 7.5 server for resolving the same.

<serviceAutoStartProviders> 
   <add name="PreWarmMyCache" type="PreWarmCache, MyAssembly" /> 
</serviceAutoStartProviders> 

However PreWarmCache class has been defined in my website and kept all logic, since it uses template from website pages.

How can I define this class from website in type ? What would be the value for MyAssembly ?

I can use assembly name if my project is web application.

I created as website. So what could be the value or how should I configure that section?

Note: PreWarmCache is placed under App_Code directory

It is highly recommended that you do not use Quartz.NET in a web application. The application pools can, and do, reset. While they can be scheduled to recycle at certain times it's still possible for them to recycle at any time. This creates unpredictable behaviour and will be difficult to track down.

I highly recommend creating a Windows Service to handle your Quartz.NET tasks. It will be more predictable, easier to debug, and decoupled from your web application. This will remove the complexity of trying to keep the application pool on all the time to run a service.

If you still want to use Quartz.NET in your web application then this SO question may help.

This has nothing to do with Quartz.Net, but is to do with the IIS server recycling the application pool after a period of inactivity.

I have the same problem, but all I am trying to do is cache data.

So I need to do the following in my applicationHost.config file:

<serviceAutoStartProviders> 
   <add name="PreWarmMyCache" type="PreWarmCache, MyAssembly" /> 
</serviceAutoStartProviders> 

This then call a function that populates an XML document and stores it as a lookup table in the cache to be used as and when needed.

And the problem is that if I use the AssemblyQualifiedName attribute it returns the following for my class:

MyApp.PreWarmCache, App_Code.<#########>, Version=0.0.0.0, Culture=neutral, PublickKeyToken=null

Where the ######### are, is changed each time the code is compiled.

I do not want to separate this into a DLL, as that would incur having to replicate the code.

So the question is still the same.

Can I/we provide an explicit assembly name for a dynamically compiled ASP.NET website's App_Code classes?

Fixed it now, taken code out into a separate assembly, compiled added reference, now all complete.

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