This is related to another question I asked:
ProcessStartInfo Multiple Arguments
I got this working with no errors in Windows Logs when run from the command line. Basically, I'm calling the console application from a Web Form. I'm passing two string arguments: an email subject and an email body. The console application then sends an email to a drop folder (for now).
const string MAILER_FILEPATH = @"C:\VS2010\Mailer\bin\Debug\Mailer.exe";
ProcessStartInfo info = new ProcessStartInfo();
string arguments = String.Format(@"""{0}"" ""{1}""",
message.Subject.Replace(@"""", @""""""),
message.Body.Replace(@"""", @""""""));
info.FileName = MAILER_FILEPATH;
Process process = Process.Start(info.FileName, arguments);
Process.Start(info);
When I call the console app from the Web Form, it still created the email in the drop folder but also generates two consecutive errors in the Windows Application Log:
Error 1:
Application: Mailer.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.IndexOutOfRangeException Stack: at Mailer.Mailer.Main(System.String[])
Error 2:
Faulting application name: Mailer.exe, version: 1.0.0.0, time stamp: 0x4ebab7ad Faulting module name: KERNELBASE.dll, version: 6.1.7601.17651, time stamp: 0x4e21213c Exception code: 0xe0434352 Fault offset: 0x000000000000cacd Faulting process id: 0x1648 Faulting application start time: 0x01cc9f079d89d950 Faulting application path: C:\VS2010\Mailer\bin\Release\Mailer.exe Faulting module path: C:\Windows\system32\KERNELBASE.dll Report Id: dbf249c0-0afa-11e1-a04b-a4badb02debf