Advertisement

05.13.2008 at 11:37AM PDT, ID: 23398928
[x]
Attachment Details

Starting application from within a Windows Service

Asked by lgropper in Microsoft Visual C#.Net

Tags: C# .net 2003

I am using Visual C# 2003 on .NET Framework 1.1


I have created a windows service to periodically move files and I want to increase it's capabilities to include running programs at certain times.

I have created a simple method called Run which I have attached.

it gets activated and goes through all the code, but nothing happens.

I have inserted a Try-Catch-Finally to track if there are any errors, and I am not getting any.  it seems to go all the way through the method, executing the log insertion.

Kind of at a loss as to why this does not function.  if I put this same code into a windows app, it runs fine.

I am trying to execute:  C:\WINDOWS\system32\calc.exe  just as a test.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
private static void Run(string appPath)
		{
			string	Mess = "Run with AppPath " + appPath + " Only";
			clsLog.WriteLogEntry("iZONE Log", "Action Test For Run Action", Mess, System.Diagnostics.EventLogEntryType.Information, 25 );
			try
			{
				Process thisProcess = new Process();
				thisProcess.StartInfo.FileName =appPath.ToString();
				thisProcess.Start();
			}
			catch (Exception ex)
			{
				Mess += "\r\n\r\n" + ex.ToString();
				clsLog.WriteLogEntry("iZONE Log", "Action Test For Run Action", Mess, System.Diagnostics.EventLogEntryType.Information, 25 );
			}
			finally
			{
				Mess += "\r\n\r\n" + "End Of Run CMD";
				clsLog.WriteLogEntry("iZONE Log", "Action Test For Run Action", Mess, System.Diagnostics.EventLogEntryType.Information, 25 );
			
			
			}
[+][-]05.13.2008 at 01:26PM PDT, ID: 21558963

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual C#.Net
Tags: C# .net 2003
Sign Up Now!
Solution Provided By: Snarf0001
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628