简体   繁体   English

在Windows IIS之外运行任务作为Windows服务

[英]Running task as windows service out of band of iis

We have a web app in which a request for a long running or high processor process is called. 我们有一个Web应用程序,其中调用了长时间运行或处理器运行速度较高的请求。

We want to create a windows service to off-load this from the IIS servers. 我们要创建一个Windows服务,以从IIS服务器上卸载该服务。 We will install this service on multiple machines to lower the wait time for these jobs. 我们将在多台计算机上安装此服务,以减少这些作业的等待时间。 One idea we are looking at is serializing the Job object into Sql Server with its JobType as another column. 我们正在考虑的一个想法是将Job对象序列化为Sql Server,并将其JobType作为另一列。

The job service will claim the job by updating the row with its indicator, this will keep other services from picking it up. 作业服务将通过使用其指示器更新该行来声明该作业,这将防止其他服务选择该作业。 Once the job is complete the service removes that entry. 作业完成后,服务将删除该条目。

What I am looking for is other, possibly better ideas to accomplish the Job Service Queuing. 我正在寻找的是其他可能更好的想法来完成作业服务排队。

I would say this is a great way to handle this issue. 我会说这是处理此问题的好方法。 The only thing I would add is that while I don't know what the Job object is or how it is created, you might be able to offload this as well. 我唯一要添加的是,尽管我不知道Job对象是什么或如何创建它,您也可以卸载它。 Instead of creating the object and serializing it to the database, simply store the raw data in SQL. 无需创建对象并将其序列化到数据库,只需将原始数据存储在SQL中即可。 Let the Services handle building the Job object themselves from the ground up. 让服务自己从头开始构建Job对象。 That way you cut the serialization out of the mix. 这样,您就可以避免序列化了。 However, if this isn't possible, I would say that your solution seems to be the most viable. 但是,如果这不可能,那么我想说您的解决方案似乎是最可行的。

If you do go this route, you could look into optimization of your Service offloading. 如果您采用这种方法,则可以考虑优化服务分流。 For example, you could wake extra services when the load gets busy and then put some to sleep when the load lightens. 例如,您可以在负载繁忙时唤醒额外的服务,然后在负载减轻时使某些服务进入睡眠状态。

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

相关问题 服务帐户在IIS和任务计划程序下具有不同的数据库行为 - Service account has different database behavior under IIS and task scheduler Windows服务:检查基本服务是否正在运行 - Windows service: check if base service is running 使用Windows任务计划程序运行SSIS作业 - Running SSIS job using Windows task scheduler IIS进程之外的长期运行的存储过程 - Long-running stored procedure out of IIS process 如何知道哪台机器正在运行Windows服务 - How to know which machine is running windows service 运行SSIS Solution / Package会从数据流任务中删除组件 - Running SSIS Solution/Package deletes components out of the Data Flow Task Windows服务运行的Exe文件保留在任务管理器中,不会被删除 - Exe files run by Windows service remain in Task Manager and are not removed 在网络服务下运行的IIS应用程序池无法连接到SQL Server - IIS Application pool running under network service can't connect to SQL Server 将Rails作为Windows服务运行时,系统DSN无法正常工作 - System DSN not working when running Rails as Windows Service 从Windows服务临时访问错误运行存储过程 - Running stored procedure from Windows Service ad hoc access error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM