Probem in launching new process from a c# .net windows service.

G

Guest

hi, all
I am using .net framwork v1.1.4322 and get an error in the following test:
I have a c# console application, basically, it is empty:
static void main(string[] args)
{
System.Console.WriteLine("Started...");
System.Threading.Thread.Sleep(60*1000); // Sleep one minute and then
exit.
}

And then I create a c# windows service and in this services, just from 1 to
150 to create process,
protected override void OnStart()
{
string strProgram = @"c:\ConsoleTest.exe";
for(int i = 0 ; i < 150; i++)
{
System.Diagnostics.Process myProc =
System.Diagnostics.Process.Start(strProgarm, "");
}
}
And then, open the windows Task Manager to see how many process will be
created. Start the service, once it reaches about 70, it starts to get two
errors.
ConsoleTest.exe Application Error
The exception unknow software exception(0xc06d007e) occurred in the
application at location 0x7c59bbf3.
ConsoleTest.exe Application Error
The application failed to initialize properly(0xc0000142). click on ok to
terminate the application.
And then in Windows Event Viewer, I saw there are serveral error,
The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot be
found. The local computer may not have the necessary registry information or
message DLL files to display messages from a remote computer. The following
information is part of the event: .NET Runtime version 1.1.4322.573- .NET
Framework Initialization Error:
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll could not be loaded.

I also tried to launch process from a c# window Form program, it does not
have any problem. It only happens in service. And I don't know how to debug
this problem either, becuase it is in service.
Thanks and have a great weekend!
 
G

Guest

Is this possible that there are some limitation on how many processes can be
created from a service?
 
W

Willy Denoyette [MVP]

No, the problem is that you spend too much time in your OnStart method.
This method is meant to initialize service after which it spawns another
thread that actually runs the service, once this is done the OnStart
returns, when you fail to return within 30 seconds the SCM will consider the
service to have failed to start properly.

Willy.

Nicky said:
Is this possible that there are some limitation on how many processes can
be
created from a service?


Nicky said:
hi, all
I am using .net framwork v1.1.4322 and get an error in the following
test:
I have a c# console application, basically, it is empty:
static void main(string[] args)
{
System.Console.WriteLine("Started...");
System.Threading.Thread.Sleep(60*1000); // Sleep one minute and
then
exit.
}

And then I create a c# windows service and in this services, just from 1
to
150 to create process,
protected override void OnStart()
{
string strProgram = @"c:\ConsoleTest.exe";
for(int i = 0 ; i < 150; i++)
{
System.Diagnostics.Process myProc =
System.Diagnostics.Process.Start(strProgarm, "");
}
}
And then, open the windows Task Manager to see how many process will be
created. Start the service, once it reaches about 70, it starts to get
two
errors.
ConsoleTest.exe Application Error
The exception unknow software exception(0xc06d007e) occurred in the
application at location 0x7c59bbf3.
ConsoleTest.exe Application Error
The application failed to initialize properly(0xc0000142). click on ok to
terminate the application.
And then in Windows Event Viewer, I saw there are serveral error,
The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot be
found. The local computer may not have the necessary registry information
or
message DLL files to display messages from a remote computer. The
following
information is part of the event: .NET Runtime version 1.1.4322.573- .NET
Framework Initialization Error:
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll could not be
loaded.

I also tried to launch process from a c# window Form program, it does not
have any problem. It only happens in service. And I don't know how to
debug
this problem either, becuase it is in service.
Thanks and have a great weekend!
 
G

Guest

Hi, Willy,

Thanks for your reply.
I have put my test projects here,
http://buglist.dotnet31.hostbasket.com/SyncServerTest.rar
There is a readme.txt in the root folder to explain what each project does.
By using this test program, when I start about 45 processes, i start to get
an exception.

Thanks.


Willy Denoyette said:
No, the problem is that you spend too much time in your OnStart method.
This method is meant to initialize service after which it spawns another
thread that actually runs the service, once this is done the OnStart
returns, when you fail to return within 30 seconds the SCM will consider the
service to have failed to start properly.

Willy.

Nicky said:
Is this possible that there are some limitation on how many processes can
be
created from a service?


Nicky said:
hi, all
I am using .net framwork v1.1.4322 and get an error in the following
test:
I have a c# console application, basically, it is empty:
static void main(string[] args)
{
System.Console.WriteLine("Started...");
System.Threading.Thread.Sleep(60*1000); // Sleep one minute and
then
exit.
}

And then I create a c# windows service and in this services, just from 1
to
150 to create process,
protected override void OnStart()
{
string strProgram = @"c:\ConsoleTest.exe";
for(int i = 0 ; i < 150; i++)
{
System.Diagnostics.Process myProc =
System.Diagnostics.Process.Start(strProgarm, "");
}
}
And then, open the windows Task Manager to see how many process will be
created. Start the service, once it reaches about 70, it starts to get
two
errors.
ConsoleTest.exe Application Error
The exception unknow software exception(0xc06d007e) occurred in the
application at location 0x7c59bbf3.
ConsoleTest.exe Application Error
The application failed to initialize properly(0xc0000142). click on ok to
terminate the application.
And then in Windows Event Viewer, I saw there are serveral error,
The description for Event ID ( 0 ) in Source ( .NET Runtime ) cannot be
found. The local computer may not have the necessary registry information
or
message DLL files to display messages from a remote computer. The
following
information is part of the event: .NET Runtime version 1.1.4322.573- .NET
Framework Initialization Error:
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\mscorwks.dll could not be
loaded.

I also tried to launch process from a c# window Form program, it does not
have any problem. It only happens in service. And I don't know how to
debug
this problem either, becuase it is in service.
Thanks and have a great weekend!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top