Quartz.net 安装程序抛出错误:“配置解析器遇到

发布于 2025-01-02 13:59:04 字数 1447 浏览 1 评论 0原文

我有一个实现 Sharp 架构的 Asp.net C# MVC 3 应用程序。几天来我一直在尝试让 Quartz.net 设置并与温莎城堡很好地合作,但没有任何运气。据我所知,我已经正确设置了所有内容,但仍然存在问题。

在我的 Global.cs 文件中,创建容器并尝试注册quartz 作业:

var container = new WindsorContainer(new XmlInterpreter("quartz_jobs.xml"));
container.AddFacility("quartznet", new QuartzFacility());

在我的 quartz_jobs.xml 文件中,我有以下内容:

<?xml version="1.0" encoding="utf-8" ?>
<quartz xmlns="http://quartznet.sourceforge.net/JobSchedulingData"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            version="1.0"
            overwrite-existing-jobs="true">
<job>
    <job-detail>
        <name>DeleteLoansWithoutClientsJob</name>
        <job-type>EasyOptions.Web.Mvc.Code.Jobs.DeleteLoansWithoutClientsJob, EasyOptions.Web.Mvc</job-type>
        <durable>true</durable>
    </job-detail>
    <trigger>
        <cron>
            <name>DeleteLoansWithoutClientsJobTrigger</name>
            <group>MyJobs</group>
            <description>A description</description>
            <job-name>DeleteLoansWithoutClientsJob</job-name>
            <job-group>MyJobs</job-group>
            <cron-expression>0 0/1 * * * ?</cron-expression>
        </cron>
    </trigger>
</job>

I have a Asp.net C# MVC 3 application implementing the Sharp Architecture. I have been trying to get Quartz.net to setup and work nicely with Castle Windsor for a few days without any luck. Based on what I know, I have setup everything correctly, but continue to have issues.

In my Global.cs file, creating my Container and trying to register quartz jobs:

var container = new WindsorContainer(new XmlInterpreter("quartz_jobs.xml"));
container.AddFacility("quartznet", new QuartzFacility());

In my quartz_jobs.xml file I have the following contents:

<?xml version="1.0" encoding="utf-8" ?>
<quartz xmlns="http://quartznet.sourceforge.net/JobSchedulingData"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            version="1.0"
            overwrite-existing-jobs="true">
<job>
    <job-detail>
        <name>DeleteLoansWithoutClientsJob</name>
        <job-type>EasyOptions.Web.Mvc.Code.Jobs.DeleteLoansWithoutClientsJob, EasyOptions.Web.Mvc</job-type>
        <durable>true</durable>
    </job-detail>
    <trigger>
        <cron>
            <name>DeleteLoansWithoutClientsJobTrigger</name>
            <group>MyJobs</group>
            <description>A description</description>
            <job-name>DeleteLoansWithoutClientsJob</job-name>
            <job-group>MyJobs</job-group>
            <cron-expression>0 0/1 * * * ?</cron-expression>
        </cron>
    </trigger>
</job>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

郁金香雨 2025-01-09 13:59:04

问题是,您将 Windsor 指向 Quartz.NET 配置文件。

有两种单独的配置:Windsor 和 Quartz.NET。现在Windsor通常是用代码来配置的(即流畅的配置),尽管它仍然支持XML配置。然而,Quartz.NET 工具当前不支持代码配置,您必须使用 Windsor 的 XML 配置(至少对于此,其他组件/工具仍可以通过代码进行配置)。然后是 Quartz.NET,通常通过外部quartz_jobs.xml 文件进行配置。

我建议使用 Quartz.NET 设施示例应用 作为参考。特别是,这里是 示例 Windsor 配置示例Quartz.NET 配置

编辑:如果 Quartz.NET 说它在 Web 应用程序中找不到quartz_jobs.xml,则需要在配置路径中包含 Web 根目录:“~/quartz_jobs.xml”(而不是普通的“quartz_jobs.xml”)

Problem is, you're pointing Windsor to the Quartz.NET config file.

There are two separate configurations: Windsor's and Quartz.NET's. Windsor is usually configured with code nowadays (i.e. fluent config), though it still supports XML configuration. However the Quartz.NET facility doesn't currently support code config, you have to use Windsor's XML config (at least for this, other components/facilities may still be configured via code). Then there's Quartz.NET, usually configured via an external quartz_jobs.xml file.

I recommend using the Quartz.NET facility sample app as reference. In particular, here's the sample Windsor config and the sample Quartz.NET config.

EDIT: if Quartz.NET says it can't find quartz_jobs.xml in a web application you need to include the web root in the configuration path: "~/quartz_jobs.xml" (instead of plain "quartz_jobs.xml")

甜心 2025-01-09 13:59:04

我写了一篇关于如何将 Quartz.NET 与 IoC 容器集成的博客文章。我的示例代码使用温莎城堡。

该博客文章可以在这里找到:http://thecodesaysitall .blogspot.com/2012/02/integrate-quartznet-with-your-favourite.html

I've written a blog post on how to integrate Quartz.NET with an IoC container. My example code uses Castle Windsor.

The blog post can be found here: http://thecodesaysitall.blogspot.com/2012/02/integrate-quartznet-with-your-favourite.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文