简体   繁体   English

ASP.Net网站项目的程序集名称

[英]Assembly name for ASP.Net website project

I have Quartz.Net integrated for Scheduler job in my ASP.Net application. 我在我的ASP.Net应用程序中为Scheduler作业集成了Quartz.Net

But it is not working automatically and seems that it got stopped when IIS is recycling Application Pool. 但它不能自动运行,并且似乎在IIS回收应用程序池时它已停止。 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. 阅读IIS应用程序池回收+石英调度后我试图在IIS 7.5服务器中配置相同的解析相同。

<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. 但是, PreWarmCache类已在我的网站中定义并保留所有逻辑,因为它使用来自网站页面的模板。

How can I define this class from website in type ? 如何从type网站定义此类? What would be the value for MyAssembly ? MyAssembly的价值是什么?

I can use assembly name if my project is web application. 如果我的项目是Web应用程序,我可以使用程序集名称。

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 注意: PreWarmCache位于App_Code目录下

It is highly recommended that you do not use Quartz.NET in a web application. 强烈建议您不要在Web应用程序中使用Quartz.NET。 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. 我强烈建议您创建一个Windows服务来处理Quartz.NET任务。 It will be more predictable, easier to debug, and decoupled from your web application. 它将更易于预测,更易于调试,并与Web应用程序分离。 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. 如果您仍想在Web应用程序中使用Quartz.NET,那么这个问题可能有所帮助。

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. 这与Quartz.Net无关,而是与IIS服务器在一段时间不活动后回收应用程序池有关。

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: 所以我需要在applicationHost.config文件中执行以下操作:

<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. 然后调用一个填充XML文档的函数,并将其作为查找表存储在缓存中,以便在需要时使用。

And the problem is that if I use the AssemblyQualifiedName attribute it returns the following for my class: 问题是,如果我使用AssemblyQualifiedName属性,它会为我的类返回以下内容:

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. 我不想将它分成DLL,因为这将导致必须复制代码。

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? 我/我们可以为动态编译的ASP.NET网站的App_Code类提供显式的程序集名称吗?

Fixed it now, taken code out into a separate assembly, compiled added reference, now all complete. 现在修复它,将代码转换为单独的程序集,编译添加引用,现在全部完成。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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