2013-03-14 98 views
1

我想從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(); 

發佈之後它也不起作用。

我錯過了什麼。 謝謝。

回答

0

這是(安裝的應用程序文件夾)缺少適當的權限。我給了它,它工作正常。 :)

0

您應該嘗試ClickOnce部署,它允許您將基於Windows的應用程序發佈到服務器。

試試這個:

System.Diagnostics.Process process1 = new System.Diagnostics.Process(); 
process1.StartInfo.FileName = Request.MApPath("yourFilePath.application"); 
process1.Start(); 
相關問題