Hi.
First off... I'm new to the board....so hello everyone....
i have a weird problem with a windows service i'm writing....
The service is upposed the scan a specified directory for any PDF files and import them into our system using the ssytem API.
Now when the service starts and i view my log file, it says, service starting, service started and nothing afterwards, it is suposed to have scanned for the files, but nothing has happened.
I even moved the code to the OnStart sub, but still nothing.
here is the code i used : (the scanning of files was in the StartThread.Start part of the code)
I added the scripting.runtime component for this.
Now when I start my service, I get the following message: "The AwardsAgent service in Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service"
I then made the service into an normal application using a windows form instead of the service, and the application works perfectly!
First off... I'm new to the board....so hello everyone....
i have a weird problem with a windows service i'm writing....
The service is upposed the scan a specified directory for any PDF files and import them into our system using the ssytem API.
Now when the service starts and i view my log file, it says, service starting, service started and nothing afterwards, it is suposed to have scanned for the files, but nothing has happened.
I even moved the code to the OnStart sub, but still nothing.
here is the code i used : (the scanning of files was in the StartThread.Start part of the code)
VB.NET:
[SIZE=2][COLOR=#0000ff]Protected[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Overrides[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] OnStart([/SIZE][SIZE=2][COLOR=#0000ff]ByVal[/COLOR][/SIZE][SIZE=2] args() [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]String[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2][COLOR=#008000]' Add code here to start your service. This method should set things[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' in motion so your service can do its work.[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' Add code here to start your service. This method should set things[/COLOR][/SIZE]
[SIZE=2][COLOR=#008000]' in motion so your service can do its work.[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] fso [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Scripting.FileSystemObject[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] rfldr [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Scripting.Folder[/SIZE]
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] f [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] Scripting.File[/SIZE]
[SIZE=2]getRegValues()[/SIZE]
[SIZE=2][COLOR=#008000]'rfldr = fso.GetFolder(path)[/COLOR][/SIZE]
[SIZE=2]rfldr = fso.GetFolder("c:\")[/SIZE]
[SIZE=2]WriteMessage("test: " + rfldr.Files.Count(), "aw")[/SIZE]
[SIZE=2]WriteMessage(" Starting Service", "AwardsAgent")[/SIZE]
[SIZE=2]StartThread.Start()[/SIZE]
[SIZE=2]WriteMessage(" Service Started", "AwardsAgent")[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
I added the scripting.runtime component for this.
Now when I start my service, I get the following message: "The AwardsAgent service in Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, the Performance Logs and Alerts service"
I then made the service into an normal application using a windows form instead of the service, and the application works perfectly!
Last edited: