在AppHarbor上模拟后台任务

发布于 2025-01-02 03:15:09 字数 494 浏览 2 评论 0原文

我正在使用 System.Runtime.Caching.MemoryCache 来模拟部署在 AppHarbor 上的正在运行的 .NET MVC 应用程序上的重复任务。

缓存中的条目是使用 CacheItemPolicy 添加的,该策略包含 AbsoluteExpiration 偏移量和调用方法并重新触发在缓存中添加项目的RemovedCallback(如此处

MemoryCache 在 Application_Start 中首次填充。它在本地运行良好,但部署在 AppHarbor 上后似乎不起作用(也尝试使用 HttpRuntime.Cache,结果相同)。

我的应用程序在 AppHarbor 上的 CANOE(免费)帐户下运行,该帐户只有一名工作人员。这是否意味着在升级到某些付费计划之前我将无法模拟后台任务?

谢谢!

I'm using System.Runtime.Caching.MemoryCache to simulate a repeated task on a running .NET MVC application deployed on AppHarbor.

Entries in the cache are added using a CacheItemPolicy which contains an AbsoluteExpiration offset and a RemovedCallback that calls a method and retriggers the adding of the item in the cache (as described here)

MemoryCache is populated first time in Application_Start. It works fine locally, but doesn't seem to work once deployed on AppHarbor (tried also with HttpRuntime.Cache, same result).

My application is running under a CANOE (free) account on AppHarbor that only has one worker. Does this mean that I won't be able to simulate the background task until I upgrade to some paid plan?

Thanks!

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

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

发布评论

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

评论(2

忆离笙 2025-01-09 03:15:09

您的应用程序必须时不时地有访问者才能发挥作用。除了 StillAlive 之外,Pingdom 也是向应用程序生成请求的不错选择。您还应该看看 MomentApp。我们预计后台任务很快就会准备就绪。

Your application has to have visitors every once in a while for this to work. Other than StillAlive, Pingdom is also a good bet for generating requests to your app. You should also take a look at MomentApp. We expect to have background tasks ready shortly.

可是我不能没有你 2025-01-09 03:15:09

我不认为升级会有帮助,他们正在努力向 AppHarbor 添加后台作业,但据我所知,它们还可用。

使用 https://stillalive.com/ 之类的服务定期访问您网站上的页面然后旋转怎么样?一个新线程并开始运行你的后台任务?它作为免费附加组件提供。

我正在考虑在等待后台任务功能可用时做这样的事情。

I don't think upgrading will help, they are working on adding background jobs to AppHarbor but to my knowledge they available yet.

What about using a service like https://stillalive.com/ to periodically hit a page on your site that then spins up a new thread and starts running your background task? Its available as a free add-on.

I was thinking of doing something like this while waiting for the background task functionality to be available.

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