开发者

WCF service singleton with callback and hosted on IIS?

I have a WCF service hosted at IIS7 web application. It's created by a WebServiceHostFactory. The client connects to a service calls the Collect method, and data are stored to DB. All working fine.

Now I would like to refresh page every time the new data are "collected" (i.e. the service method Collect is called).

My question is: What is the best approach ?

I was considering th开发者_Python百科e CallbackContract, but this would require a singleton pattern (service is now PerCall), or is it a wrong assumption ? Is this approach possible ?

My logic is:

  1. ASP.NET page subscribes to WCF service
  2. the service singleton is created from now on
  3. when method is called the services calls subscribers (clients)
  4. there should be therefore only one service instance in order to subscription to work (or is it ?)
  5. the client page refreshes itself

regards, Kate


You can't refresh the page in a user's browser from the sever. Browsers use HTTP, which is a request-response protocol, so if the browser hasn't issued a request, it won't be looking for a response from your server.

If you have a Silverlight application hosted in a browser, that's a different story, but you didn't mention Silverlight anywhere. You would also be able to do what you're asking using WebSockets in HTML5, but that's not fully standardized yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜