如何在网络服务器上自动更新数据库
I am developing the online bidding system using SP.NET where I need to close the auction if the auction time is get closed without any bid.
As on this website (archived link)
Any ideas on how to implement that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我可以想到 4 种方法来做到这一点:
1:有点 hackish,但您可以尝试使用描述的“缓存过期技术”此处
简而言之,您依靠 ASP.NET 缓存过期机制在设定的时间运行某些代码。在您的情况下,您可以将此时间设置为拍卖创建时的拍卖到期时间。然而,这是不可靠的,如果服务器重启怎么办?你可以和你的缓存说再见了。但如果您使用无法访问服务器的共享服务,这可能是您的解决方案。
2:更好一点,您可以编写一个 .aspx 页面并每 X 分钟从 Windows 任务计划程序调用它来运行您的代码。这里的问题是您必须执行公共页面。可能是一个安全问题。
3:更好的是,你可以编写一个Windows服务。但如果您没有时间,这可能会导致工作量太大。
4:看看 Quartz.NET,这是同名行业标准 Java 项目的 .NET 端口。我还没有尝试过,但看起来很有希望。
I can think of 4 ways to do this:
1: A bit hackish, but you can try to use the "cache expiration technique" described here
In short, you rely on the ASP.NET cache expiration mechanism to run some code at a set time. In your case you could set this time to the expiration time of the auction the moment the auction gets created. However, this is unreliable, what if you get a server restart? You can say bye to your cache. But if you use a shared service where you don't have access to the server, this could be your solution.
2: A little better, you can write an .aspx page and call it from the Windows task scheduler every X minutes to run your code. The issue here is that you would have to execute a public page. Could be a security concern.
3: Much better, you can write a Windows Service. But this may be too much work if you lack the time.
4: Have a look at Quartz.NET, this is a .NET port of the industry-standard Java project of the same name. I haven't tried it but it looks promising.