Search code examples
c#asp.netiis.net-assembly

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


Solution

  • 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.