offline application block

Topics: CAB & Smart Client Software Factory
Jun 23, 2004 at 9:10 AM
originally posted by: minman

I have used it in a windwos application and for reporting gps positions to my web service via notebook computer and wireless card.

Now I would like to be able to create a windows service that utilizes the offline application block doing the same thing - reporting gps positions. Having some problems. Does anyone have an example of using the offline application block with a windows service.
Jun 23, 2004 at 6:29 PM
originally posted by: bbutton

Hey, minman,

I just started thinking about your problem here and how I could possibly design it. Can you give more information about the kinds of problems you were having? You don't give much detail :)

bab
Jun 24, 2004 at 4:59 AM
originally posted by: minman

After having great success with the windows application I attempted to port my application to the windows service.

In my windows application I relied heavily on the example provided with the offline application block. I pretty much just moved my app.config file from the windows application to the windows service.

Having looked at it again this morning, it seems that the problem lies in that the connection to the CacheDatabase and QueueDatabase relies on windows integrated security.

Since the windows service runs as local system there seems to be a problem connecting the database. I created a sql user and tried using sql authentication and I changed the config file. I got past the login but then there were problems with stored procedures not being found???

I made my sql user the dbo for both databases so I don't know what is up there. So then I tried running the windows service under the user account and I stopped getting exceptions in the event log. I have not gone further than that I still need to see if it actually works. At least it has stopped giving me exceptions upon start.

I work for a city and this application will be deployed on notebook computers in city vehicles. Ideally I think I would like to run the service as local system. I will need an installer too which complicates matters further. My installer will have to install my windows service, MSDE, and possibly the .net framework as well.

If you know of a way to use the offline application block while running as local system that would be very helpful. I will have to install this application on possibly a large number of machines so I'm trying to streamline the process. I want it to run as a windows service so that the users are not required to run an application in order for us to see where they are.

I can share the exceptions that I am getting or any code with whomever might be willing to help.
Jun 24, 2004 at 10:15 AM
originally posted by: JohnAskew

I cannot describe actual mechanical details, but here is my gut feeling about the offline block and windows services.

Not gonna work.

Windows Services are segregated from the application address spaces such that interprocess communication is not supported. For instance, many moons ago, a friend of mine had no success trying to get window handles from within a service -- some OS security mechanism probably prevents it. Windows Services are pushed down to a lower realm than desktop apps, they don't play well together. So much for my gut.

This must be why there are so many NotifyIcon -- system tray apps instead of services; interprocess communication and the application realm.

Somebody please reply that I am way wrong and this IS doable...

I was also thinking, perhaps the ConnectionManager part of the block could be a service, and somehow launch the rest of the block above the service realm...

I just hope someone can definitively clarify this issue. I am guessing at this point, and I have too much other stuff to do to research it.