English 中文(简体)
我怎样才能只为所有客户提供一次网络服务?
原标题:How can I have only one instance of a Web service used for all the clients?

我有一个网络服务,执行可能需要几个小时才能完成的任务(按时间顺序排列)。

我愿与服务器连接的所有客户分享这项任务的地位(如果使用网络应用程序,就这样)

For example, the first client that calls the page http://localhost/process.aspx will instantiate the web service and it will call a method to start executing the task. A percentage number will be displayed showing the status of completion. I can do this by polling the web service using AJAX.

如果还有另一个客户试图打开该网页,则该网页应获得同样的百分比信息,因此不会产生新的网络服务。

How is the best way of doing this? I thought about different solutions but sooner or later I find new problems. These are some of the possible alternatives:

  • Create an static object of the Web service.
  • Create the object in the global.asax file.

你们是否还有其他想法? 我不太熟悉网站设计,这正促使我zy。 如果你说谎的话,我将不胜感激。

增 编

问题回答

问题在于确保有关单一程序的信息储存在一个地点。

例如,可以通过使用申请标语来应用你最初的想法,但这种想法将在一个分类的IIS假设情景中分解。

我不认为数据库是绝对的最佳解决办法,但我认为它会给你希望的东西。

如果100名客户同时尝试启动这一进程,只有一人才能成功? 锁定设施的数据库将有助于你实现这一目标。

有一种方法(假设网络服务中的WCF)允许你完全有一例服务......link

我认为,这是你努力做到的。

假设我正确理解你的要求。 你的网络服务不应成为“工人”目标的例子。

您的网络服务请求应标入一个数据库(如另一台邮局所指出的)或一些公司的信息库。 此时此刻,你的“工作”处理员(可能是某些类型的服务)应当按照要求接管工作。

从根本上说,你想要把你的申请变成像这样的事情。

<><>>>>> 网络服务—————————————— Worker

关于批次的任何进一步要求,都应由网站服务查询数据库管理。

www.un.org/Depts/DGACM/index_spanish.htm 网上服务由NOT DESIGNED改为DO工作。





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签