2017-01-01 57 views
0

你能給的你如何在Azure中的Web應用程序跑APPCMD與SignalR更多的細節,因爲它需要管理員權限?我不認爲下面會出於這個原因。配置SignalR與Appcmd.exe的Azure上的Web應用程序

protected void Application_Start() 
     try 
     { 
      var windowsDir = Environment.GetEnvironmentVariable("windir"); 
      var command = System.IO.Path.Combine(windowsDir, @"System32\inetsrv\appcmd.exe set config/section:system.webserver/serverRuntime/appConcurrentRequestLimit:10000"); 
      Process.Start(command); 
     } 
     catch (Exception ex) 
     { 
      Trace.WriteLine(ex.GetBaseException().Message); 
     } 
} 

回答

0

Azure的Web應用程序在運行sandbox。我們沒有權限編寫系統驅動器。通過在驅動器上的ACL所控制

系統驅動器訪問

應用程序可以讀取系統驅動器。應用無法寫入系統驅動器上的任何位置,在沙箱中實現(即即使允許的ACL系統驅動器上寫入的位置,沙箱會限制它)。

但是,如果您選擇Azure雲服務,我們可以使用appcmd.exe in startup task。當然,它會像一個魅力,如果選擇Azure的VM作爲Web服務器。