H
Holger (David) Wagner
I'm trying to start a process from an ASP.NET Web application. The
reason I need this is to encapsulate a (unmanaged) DLL that sometimes
crashes. If I run this DLL directly with P/Invoke from within my ASP.NET
application, this sometimes crashes the whole IIS.
So the idea is to have a separate server which accepts requests (via a
socket connection), calls the DLL with the given parameters and returns
the results.
This works well when I start the server from a console, but it needs to
be started automatically from the Web application. Currently, I'm doing
it this way:
Process serverProcess;
Int32 port = 13000;
String server = "127.0.0.1";
for (int i=0; i < 3 && client == null; i++) {
try {
client = new TcpClient(server, port);
} catch (SocketException e) {
// probably, the server is not running, so start it now!
if (serverProcess != null) {
serverProcess.Kill();
serverProcess = null;
}
serverProcess = new Process();
serverProcess.StartInfo.FileName = exePath;
serverProcess.StartInfo.Arguments = "127.0.0.1 13000";
serverProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
serverProcess.Start();
}
}
But this "serverProcess.Start()" doesn't work :-(
I get an error dialog "JIT Debugging", "JIT Debugging failed with the
following error: Zugriff verweigert (access denied)", "JIT Debugging was
initiated by the user account "\myMachine\ASPNET". I have added ASPNET
to the Debugger Users group - but that doesn't seem to change anything.
I've also tried it with ProcessWindowStyle.Hidden - but that doesn't
improve things either...
Any ideas how to solve this?
kind regards,
david
reason I need this is to encapsulate a (unmanaged) DLL that sometimes
crashes. If I run this DLL directly with P/Invoke from within my ASP.NET
application, this sometimes crashes the whole IIS.
So the idea is to have a separate server which accepts requests (via a
socket connection), calls the DLL with the given parameters and returns
the results.
This works well when I start the server from a console, but it needs to
be started automatically from the Web application. Currently, I'm doing
it this way:
Process serverProcess;
Int32 port = 13000;
String server = "127.0.0.1";
for (int i=0; i < 3 && client == null; i++) {
try {
client = new TcpClient(server, port);
} catch (SocketException e) {
// probably, the server is not running, so start it now!
if (serverProcess != null) {
serverProcess.Kill();
serverProcess = null;
}
serverProcess = new Process();
serverProcess.StartInfo.FileName = exePath;
serverProcess.StartInfo.Arguments = "127.0.0.1 13000";
serverProcess.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
serverProcess.Start();
}
}
But this "serverProcess.Start()" doesn't work :-(
I get an error dialog "JIT Debugging", "JIT Debugging failed with the
following error: Zugriff verweigert (access denied)", "JIT Debugging was
initiated by the user account "\myMachine\ASPNET". I have added ASPNET
to the Debugger Users group - but that doesn't seem to change anything.
I've also tried it with ProcessWindowStyle.Hidden - but that doesn't
improve things either...
Any ideas how to solve this?
kind regards,
david