我想從Web應用程序調用Windows應用程序。 我嘗試了以下代碼:從Web應用程序調用Windows應用程序
此處「AppA_VB」是我正在運行的桌面應用程序。 和我有另一個網絡應用程序,我在其中添加了桌面應用程序的參考。 當我在本地pc上運行web應用程序時,它工作正常,但它不在發佈之後。
AppA_VB.Form1 appAform = new AppA_VB.Form1(); appAform.Show();
var c = GetAll(appAform, typeof(System.Windows.Forms.TextBox));
foreach (System.Windows.Forms.TextBox t in c)
{
if (t.TabIndex == 1)
{
t.Text = TxtName.Text;
}
if (t.TabIndex == 2)
{
t.Text = TxtAddress.Text;
}
if (t.TabIndex == 3)
{
t.Text = TxtStandards.Text;
}
}
var b = GetAll(appAform, typeof(System.Windows.Forms.Button));
foreach (System.Windows.Forms.Button btn in b)
{
if (btn.Text.ToString().ToLower() == "save")
{
btn.PerformClick();
}
}
,我也已經嘗試這一個,
的System.Diagnostics.Process過程1 =新的System.Diagnostics.Process();
process1.StartInfo.FileName = Convert.ToString(ConfigurationManager.AppSettings["ExePath"]);
// Start the process
process1.Start();
發佈之後它也不起作用。
我錯過了什麼。 謝謝。