如何指示 SharePoint 场在特定服务器上运行计时器作业?

发布于 2024-07-15 20:24:38 字数 264 浏览 5 评论 0原文

我们有一个 SP 计时器作业,运行良好一段时间。 最近,管理员在场中加入了另一台服务器,因此 SharePoint 决定开始在此另一台服务器上运行此计时器作业。 问题是服务器上没有安装所有依赖项(即 Oracle),因此作业失败。 我只是在这里寻找阻力最小的路径。 我的问题是有没有办法强制计时器作业在您想要的服务器上运行?

[编辑] 如果我可以通过适合我的代码来做到这一点。 我只需要知道执行此操作的 API(如果确实存在)是什么。

We have an SP timer job that was running fine for quite a while. Recently the admins enlisted another server into the farm, and consequently SharePoint decided to start running this timer job on this other server. The problem is the server does not have all the dependencies installed (i.e., Oracle) on it and so the job is failing. I'm just looking for the path of least resistance here. My question is there a way to force a timer job to run on the server you want it to?

[Edit]
If I can do it through code that works for me. I just need to know what the API is to do this if one does exist.

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

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

发布评论

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

评论(5

定格我的天空 2024-07-22 20:24:38

如果我是在追求显而易见的事情,我深表歉意; 我只是还没有看到有人深入研究它。

约束自定义计时器作业(即,从 SPJobDefinition 派生的您自己的计时器作业类)是通过控制构造函数参数来完成的。

假设在创建计时器作业期间未指定目标服务器,计时器作业通常在提交它们的服务器上运行(如 vinny 所示)。 不过,SPJobDefinition 类型的两个重载构造函数分别接受 SPServer 和 SPJobLockType 作为第三个和第四个参数。 正确使用这两个参数将允许您决定作业的运行位置。

通过将目标服务器指定为 SPServer 并将 SPJobLockType 指定为“作业”,您可以限制您创建的计时器作业实例在您选择的服务器上运行。

有关我所描述内容的文档,请参阅 MSDN:http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spjobdefinition.spjobdefinition.aspx

我对您正在运行的代码一无所知,但自定义计时器作业通常是在功能激活期间设置的。 我感觉到你的代码库可能不是你自己的(?); 如果是这样,您可能需要查找从 SPFeatureReceiver 派生的一个或多个类型/类。 在此类类的 FeatureActivated 方法中,您可能会找到实际执行计时器作业实例化的代码。

当然,您还需要查看自定义计时器作业类(或多个类)本身,以了解它们是如何实例化的。 有时,开发人员会将类的实例化构建到类本身中(例如,通过工厂方法模式)。 不过,在计时器作业类和 SPFeatureReceiver 实现之间,您应该能够找到需要更改的内容。

我希望这有帮助!

I apologize if I'm pushing for the obvious; I just haven't seen anyone drill down on it yet.

Constraining a custom timer job (that is, your own timer job class that derives from SPJobDefinition) is done by controlling constructor parameters.

Timer jobs typically run on the server where they are submitted (as indicated by vinny) assuming no target server is specified during the creation of the timer job. The two overloaded constructors for the SPJobDefinition type, though, accept an SPServer and an SPJobLockType as the third and fourth parameters, respectively. Using these two parameters properly will allow you to dictate where your job runs.

By specifying your target server as the SPServer and an SPJobLockType of "Job," you can constrain the timer job instance you create to run on the server of your choice.

For documentation on what I've described, see MSDN: http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.spjobdefinition.spjobdefinition.aspx.

I don't know anything about the code you're running, but custom timer jobs are commonly setup during Feature activation. I got the sense that your codebase might not be your own (?); if so, you might want to look for the one or more types/classes that derive from SPFeatureReceiver. In the FeatureActivated method of such classes is where you might find the code that actually carries out the timer job instantiation.

Of course, you'll also want to look at the custom timer job class (or classes) themselves to see how they're being instantiated. Sometimes developers will build the instantiation of the class into the class itself (via Factory Method pattern, for example). Between the timer job class and SPFeatureReceiver implementations, though, you should be on the way towards finding what needs to change.

I hope that helps!

身边 2024-07-22 20:24:38

场中的服务器必须相同。
如果您碰巧为 Web 前端使用虚拟机,您可以捕捉服务器并配置副本,以便您知道它们都是相同的。

Servers in a farm need to be identical.
If you happen to use VMs for your web front ends, you can snap a server and provision copies so that you know they are all identical.

就像说晚安 2024-07-22 20:24:38

每个定义的计时器作业在所有 Web 前端上运行。

如果您需要在特定服务器上运行计划逻辑,则需要在计时器作业中专门对其进行编码,或者改用“标准”NT 服务。

Timer jobs per definition run on all web front ends.

If you need scheduled logic to run on a specific server, you either need to specifically code this in the timer job, or to use a "standard" NT Service instead.

深海夜未眠 2024-07-22 20:24:38

我认为将 SPJobLockType 设置为“作业”的副作用是它将在提交作业的服务器上执行。

I think a side effect of setting SPJobLockType to 'Job' is that it'll execute on the server where the job is submitted.

神也荒唐 2024-07-22 20:24:38

您可以使用业务日志实现 Web 服务并将该 Web 服务部署到一台计算机。 然后你的定时器作业可以定期触发你的网络服务。

当你的定时器工作运行时,它应该不那么重要。 SharePoint 自行决定在何处运行计时器作业。

You could implement a Web Service with the business logig and deploy that Web Service to one machine. Then your Timer Job could trigger your web service periodically.

The it sould be not that important wher your timer job is running. SharePoint decides itself where to run the timer job.

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