I have a windows service configured to manage .Net user tasks. Organization:
-Windows Service controls the schedule and, if necessary, starts a working .exe.
-Worker.exe (a lightweight winform application) uses a command line argument to pull out a DLL (plugin) and run some code.
It works for many months. I recently migrated it to Server 2012 (since 2008, IIRC) - this may be unrelated, but it's hard to say. Starting some time after the migration, I ran into a problem when the working .exe "starts" after calling process.start (), but does not reach my code. There are no errors or anything else, it just freezes while the application is loading.
The service code that runs it is pretty standard.
Process p = new Process();
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = Path.Combine(temp.Path, Path.GetFileName(ExecutablePath));
psi.Arguments = CommandLineArgs.ConcatenateList(" ");
psi.UseShellExecute = false;
psi.RedirectStandardError = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardOutput = true;
psi.CreateNoWindow = true;
psi.ErrorDialog = false;
psi.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo = psi;
p.Start();
- . , , - , - - 5 , , , 2 .
, - , .
, - - . , , 30 . - , : , , , (, , , ).
, , , , .
- , form_load.
static class Program
{
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
. - , , . , .
4 2015 .: Minidump:
Minidump , / static static void main, :
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
.
.
4 2015 . # 2:
, , . (, )
, . .
, , .
:
static class Program
{
[STAThread]
static void Main()
{
Application.Run(new AppContext());
}
}
class AppContext : ApplicationContext
{
public AppContext()
{
}
}