rternier

I have a windows service that transmits data to a webservice. This service needs to be running at all times.

However, if there is a chance that the Web Services cookie session is lost the Windows Service needs to prompt the user that they will need to "Sign In" to re-authenticate themselves.

What is the best way for my service to tell the user to do something... The service is always running. I have a small client app that users can load up and muck with settings, but I don't want them to load this up to see their status.

Any thoughts



Re: Visual C# General Windows Service - needs user interaction... or help with it :P

H. Tony


when the session is lost, the windows service can simply return that error message back to the web service. so the user will receive response from the webservice to prompt to login again.

the only problem is that, is the cookie stored on the server side by the windows service more than likely a cookie is something that's stored on the client side. if the session is lost, then session authentication fails, you can use your web page to prompt user to login again, without involving webservice or windows service.






Re: Visual C# General Windows Service - needs user interaction... or help with it :P

rternier

Hey,

Thanks for the reply.

I'm using sessions on the WebService, so that returns a cookie which is stored in the CookieCollection of the webservice object on the client.

Even if the session is lost, the webservice can tell the Service that, but how can I get the service to send information to other programs (I don't think i really want to get into .NEt remoting that much...).

I do have a client WinForm application that I can launch from the service. So if the service needs to launch it, it can. however iwth that, I do not know how to launch an application in the right process space.

Example: If the service is running and no one is signed in, I can't launch any application - I have to wait for someone to sign in. When someone is signed in, my service can launch that app in the correct process space... but how do you determine what process space





Re: Visual C# General Windows Service - needs user interaction... or help with it :P

Peter Ritchie

You can't interact with the user and and you can't launch GUI-based applications from a service (the service heap doesn't have enough space to handle a GUI based application). On Vista, interaction with a service and a desktop is not implemented. If you want to support Vista, you can't directly interact with the user...






Re: Visual C# General Windows Service - needs user interaction... or help with it :P

rternier

Please note I'm an ASP.NET Developer - I rarely do client side development Big Smile

I saw this on these forums (here):

System.Diagnostics.Process.Start("IExplore.exe", http://www.msn.com);


The Form Application I have sits in the same directory the service is launched in - so finding the path to it is quite easy.


However I was told that I have to be careful with how I start a process to make sure it's in the right spot...


Is there no possible way at all for my service to do:


Service:*** Ninjas have appeared and I need to launch an application to save my butt

<Service launches application>


Even if the service doesn't care about the application... just wants to launch it.


If not, can you see any other way I could somehow tell a user they need to log-in if the service fails








Re: Visual C# General Windows Service - needs user interaction... or help with it :P

H. Tony

So far, the problem looks like a typical webservice scenario.

user interacts with the webservice interface, login, perform action based on session authentication.

webservice calls windows service to perfom certain tasks. my suggestion is to pass the user information from webservice(which holds the authenticated session) to windows service, so that the windows service knows what process to run and returns the result back to webservice.

the windows service itself is 'sessionless'. does that solve your problem

rternier wrote:
Hey,

Thanks for the reply.

I'm using sessions on the WebService, so that returns a cookie which is stored in the CookieCollection of the webservice object on the client.

Even if the session is lost, the webservice can tell the Service that, but how can I get the service to send information to other programs (I don't think i really want to get into .NEt remoting that much...).

I do have a client WinForm application that I can launch from the service. So if the service needs to launch it, it can. however iwth that, I do not know how to launch an application in the right process space.

Example: If the service is running and no one is signed in, I can't launch any application - I have to wait for someone to sign in. When someone is signed in, my service can launch that app in the correct process space... but how do you determine what process space





Re: Visual C# General Windows Service - needs user interaction... or help with it :P

rternier

It helps yes. I forgot to mention the service is running on a client app - not the server where the webservice is running.

What happens is I have an Authentication Factory set up (incase we have to deal with many different forms of Authentication), that factory then serializes it's Authentication Object (loaded up through reflection), and then Does a 64 bit string compression on it.
The service then takes that, ships it to the web service where it decodes it, de-serializes the Authentication obejct.
The service then sets 2 session variables. The cookie is sent back to the client - the cookie contains the SessionID so it will not lose the session.

When the session is lost I need to prompt the user on the client to re-log in. However, I have no idea how a service can tell the user, or do anything to inform the user :\





Re: Visual C# General Windows Service - needs user interaction... or help with it :P

rternier

Thanks for the help guys. I'm going to go the "MSN Messenger" route where if the application is loaded from the win.ini and that will handle the authentication.

Big Smile