"rawCoder" <ra******@hotmail.com> wrote in message news:<ev**************@TK2MSFTNGP10.phx.gbl>...
Hi Rathtap,
You might wanna look into the "Thread Window" of the Debug Windows to get a
grab on the multiple threads spawning asynchronously.
Also if i am correct , u need the pdb and the exe of the application you are
spawning OR you need to have the other app running in debug mode to debug
that application when you call it.
Hope it helps
Thank You,
rawCoder
Visual Studio will not let me run two apps in debug mode at the same
time. What I am trying to do is asynchronously kick off a console app
from a web page. Asynchronously so that I can display a wait window.
I am unable to debug through one app to the other.
Also, in the calling app, while debugging, the debugger does not
always step into the Delegate when I invoke BeginInvoke and when it
does, it doesn't step through each line of code in the function
RunProcess but steps right out and back to the next line in
btnImport_Click:
Code snippet:
//Declarations
delegate string ShowProgressDelegate(string cmd);
private void btnImport_Click(object sender, System.EventArgs e)
{
string command=txtFileToImport.Text;
ShowProgressDelegate showProgress = new
ShowProgressDelegate(RunProcess);
IAsyncResult ar = showProgress.BeginInvoke( command, null, null);
Session["Finished"]=false;
Response.Redirect("wait.aspx",false);
}
private string RunProcess(string cmd)
{
try
{
String username = System.Security.Principal.WindowsIdentity.GetCurre nt().Name;
System.Security.Principal.WindowsImpersonationCont ext
impersonationContext;
impersonationContext =
((System.Security.Principal.WindowsIdentity)User.I dentity).Impersonate();
Session["Finished"]=false;
System.Diagnostics.Process p;
p= new System.Diagnostics.Process();
p.StartInfo.FileName= Server.MapPath("\\AccountApp") +
"\\Importer\\bin\\Debug\\Importer.exe";
p.StartInfo.Arguments=cmd;
p.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.UseShellExecute = false;
p.Start();
string output= p.StandardOutput.ReadToEnd();
p.WaitForExit();
p.Close();
Session["Finished"]=true;
impersonationContext.Undo();
lblNotify.Text="File Imported";
Session["ImportData"]=output;
return output;
}
catch(Exception ex)
{
lblNotify.Text=ex.Message;
Session["Finished"]=true;
}
return string.Empty;
}