Implementation of a message service in ASP.NET MVC
I have an infrastructure, bussiness rules and other logic, that I use in a WPF application, in it I have a messaging service that implements an message service interface, this service is register in a Container, I use Castle Windsor. Every time that the infrastructure needs to show any kind of messages it uses this service and shows a message and waits for the reply, with this I don't have to a request to the GUI/WPF to show a message. My problem is that I'm using this same infrastructure for a ASP.NET MVC site and I having some problems in find a solution where I can use this same interface. Basically if the message service has to show a messa开发者_如何学Pythonges it should be able to post a message box in the browser, preferably via AJAX and wait for the reply of the user and then continue the execution according to the answer. I don't know if I'm made my self clear enough on the problem. Any hints on how to implement such a service would be much appreciated. Thanks.
The problem is the server knows nothing about open browsers, therefore it can't signal the broswer to show the message.
The solution would appear to be to queue messages from the service, have some script on the page that checks (using ajax) for items in the queue, and display messages as appropriate.
精彩评论