Windows Service

MrScripter
12-28-2004, 11:28 AM
I'm new to creating a windows service, and have followed the tutorial on msdn, that creates a log file every 10seconds I think it is. But what I want to do is run a vb6 program whenenver their is a change in a .mdb file. Let me explain in more detail. I have a program, written in vb6, and it's connected to an access db on the back end. What I want to do is run that program whenever the .mdb file changes. I'm basically looking for any ideas, since I have never written a windows service before. Any suggestions?

MrScripter
01-03-2005, 02:12 PM
Hmm any ideas?

robertg
01-04-2005, 05:26 AM
One possible idea. Have your service check and store the date/time stamp of the .mdb, then when it runs again, recheck the date/time stamp and compare the each new check with the original. When they don't match, you know a change has been made. Then, the lastest date/time stamp would be used for future comparisions.

unclebill
01-04-2005, 11:46 AM
Another alternative is to have your program run continually and periodically [every minute, 5 mins, hour, etc.] check the last written timestamp on the target file. Then your program can perform your desired operation(s) when it detects the change to the mdb.

MrScripter
01-04-2005, 03:56 PM
Hey guys, thanks for the replies, I'm not at work right now but I have a question on parts of the code, i'd explain now but i think it'll be easier to understand if i post the code to, I'll post back tomorrow when I have the code.

MrScripter
01-20-2005, 11:18 AM
I'm trying to write a file onto our server with a windows service. For testing right now im just using: FileOpen(1, "path/filename", OpenMode.Output)
to test to see if it will work. When I run that code in my windows service, it doesn't work. However, if I run that code to a path that is on my local computer, it works just fine. also, I did a fileCopy(), that copied a file from my computer to the server and that worked, in the service. Any ideas why it wont let me write a file to the server from the windows service? (also, it works fine when I run the fileopen() in a regular vb application, it's just in the service it doesn't want to work).

HardCode
01-20-2005, 11:24 AM
1. Is the service written in VB.NET?
2. Is the service desktop interactive, where you need to be loggin in?
3. What account is the service being run under?
4. Does that account have permission to create a file on the server?

MrScripter
01-20-2005, 11:31 AM
1. Is the service written in VB.NET?
2. Is the service desktop interactive, where you need to be loggin in?
3. What account is the service being run under?
4. Does that account have permission to create a file on the server?
1. Yes, it is written in VB.NET.
2. I guess, I really don't know. I wrote the service on my computer while I was logged in. So i'm assuming, yes?
3. It's run under my account.
4. yes, I have permissions.

HardCode
01-20-2005, 11:35 AM
When you created the service, there should have been provided a file ProjectInstaller.vb. Open that file in the IDE, click on the default-named ServiceProcessInstaller1 control, and look at the properties window. Check the Account property. Is it set to LocalSystem?

MrScripter
01-20-2005, 11:37 AM
Yes, it is(was) as an attempt to fix my problem I then changed it to Network Service. Still no go.

HardCode
01-20-2005, 11:58 AM
How did you install the service? Can you verify that it is running in Computer Management --> Services?

MrScripter
01-20-2005, 12:04 PM
I installed the service with the InstallUtil command in the .net command prompt. Yes I see the service in my services on my computer, currently that is how im starting it. I go into my services and start the service(then I stop it and restart it agian for testing). It's just when I try to create a file to the server with the service it doesn't work. But if I use a regular vb.net app, it will create the file just fine. I'm really at a loss on why it's not working.

HardCode
01-20-2005, 01:17 PM
Can you post the full code where you are trying to create the file?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum