Calling console app (dtexec) from windows service

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I need to call a console app (dtexec) from a windows service in a
client/server architecture. I have the application setup so that the
client application is called with a package name, which makes a call to
a dll on the remote server. I have read up on this on the web and I
know that you can't run a GUI app from within windows service, but
apparently console apps are ok. I am trying exactly that but it's not
working. Here is my code:

Server side:

public bool Execute(string strPackageName)
{
log.Info("strDTExecPath: " + strDTExecPath);
log.Info("strPackageName: " + strPackageName);
try
{
log.Info("Starting");
System.Diagnostics.Process.Start(strDTExecPath,
strPackageName);
log.Info("Finishing");
}
catch (Exception ex)
{
log.Error(ex.ToString());
return false;
}
return true;
}

Client Side:

static void Main(string[] args)
{
try
{
string strURLRemoteClass =
ConfigurationSettings.AppSettings["URLRemoteClass"];
string strPackageName = args[0].Trim();
if (strPackageName.Length <= 0)
{
log.Info("No package name provided in the
arguments.");
return;
}
// Step 1: Register a TCP client channel
TcpClientChannel channel = new TcpClientChannel();
ChannelServices.RegisterChannel(channel);
// Step 2: Register the remote class as a valid type
// in the client's application domain
RemotingConfiguration.RegisterWellKnownClientType(
typeof(DTExec),
strURLRemoteClass);
// Step 3: Instantiate the remote class
objDTExec = new DTExec();

if (objDTExec.Execute(strPackageName))
log.Info("Success");
else
log.Info("Failure");
}
catch (Exception ex)
{
log.Info(ex.ToString());
}
}

No errors are logged on either side. In the server log file I get this:


2007-01-22 15:13:19,763 [4624] INFO DTExecServerLog [.ctor:0] -
strDTExecPath: C:\...\Visual Studio
2005\Projects\Learning\Test\Test\bin\Debug\Test.exe
2007-01-22 15:13:19,773 [4624] INFO DTExecServerLog [Execute:0] -
strDTExecPath: C:\...\Visual Studio
2005\Projects\Learning\Test\Test\bin\Debug\Test.exe
2007-01-22 15:13:19,773 [4624] INFO DTExecServerLog [Execute:0] -
strPackageName: C:\foo.txt
2007-01-22 15:13:19,773 [4624] INFO DTExecServerLog [Execute:0] -
Starting
2007-01-22 15:13:19,844 [4624] INFO DTExecServerLog [Execute:0] -
Finishing


Any ideas as to what I am doing wrong?

Any comments on how we can run DTEXEC remotely without having to
install anything additional on the workstation are also welcomed.

.



Relevant Pages

  • RE: Can I serialize cached credentials for later authentication on
    ... The logon session only disappears when all tokens referencing it are closed, ... Note that the original request made no assumption with regards to the moment ... When the network is unavailable for client ... Service application on the same client machine so that this Windows Service ...
    (microsoft.public.platformsdk.security)
  • Re: I am at a lost.... WCF
    ... I can consume the WCF service that hosted in a remote Windows Service. ... Make sure we have changed the client configuration to align the server address. ... My first guess would be that there is a firewall in the way ... I did follow your conversation with the original poster and today I ...
    (microsoft.public.dotnet.framework.webservices)
  • Re: Looking For Code Sample and Request Feedback
    ... I would prefer to use a Windows Service but a web service will do to. ... What is very easy to do on a Server 2003 and with VBNet? ... > I am looking for a code sample that communicates from a client to a remote> Windows Service on another computer over the internet, that is the Windows> Service performing instructions the client sends. ... the client does the office automation and the actual> communication of the commands to this server. ...
    (microsoft.public.dotnet.languages.vb)
  • RE: NetworkService - Could not establish secure channel for SSL/TL
    ... I understand you have a .net based windows service ... Based on my understanding on this, the problem is still likely a permission ... issue specific to the client machine's authentication certificate. ...
    (microsoft.public.dotnet.framework)
  • Guarantee reload of assembly when change is made on network share
    ... A single windows service is to be installed on the ... enterprise client workstations. ... replace a *.dll on the file network share that the client service uses ...
    (microsoft.public.dotnet.distributed_apps)