2012-10-11 174 views
1

我們的團隊已經編寫了一個包裝應用程序/界面,以使用msiexec靜默安裝一系列msi。msiexec:無聲部署網站到IIS

我的問題涉及安裝指向IIS的msi。

我不斷收到以下錯誤

錯誤1314指定的路徑 '默認Web站點/根/ someVirtual' 是 不可用。 Internet信息服務器可能沒有運行,或者路徑存在並被重定向到另一臺計算機。請在Internet服務管理器中檢查該虛擬目錄的 狀態。

微星獲取與設置以下參數如下

msiexec.exe /i "D:\SOME.msi" UseShellExecute="false" TARGETSITE="Default Web Site" TARGETVDIR="someVirtual" TARGETAPPPOOL="DefaultAppPool" /qn /l* D:\SOME_log.txt 

執行我知道,因爲我可能錯過了一些設置/選項,我需要設置這個問題stricly IIS相關。

至於我可以看到我的虛擬是在這個位置「NT4334RB \網站\默認網站\ someVirtual」,所以我最好的猜測是,「默認Web站點/ROOT/someVirtual 「 - ROOT是問題,需要設置,但是是什麼?如何?

我剛剛在日誌文件中遇到這一行 - 我認爲這可能是有用的?

四處爲approot從網址鍵「TargetURL的」

+1

。 MSI本身不支持IIS,因此該功能由自定義邏輯提供。我看到你正在悄悄地運行這些應用程序。以交互方式運行它們並在安裝程序移到InstallExecuteSequence之前仔細檢查安裝程序從用戶*收集的所有屬性*可能會很有用。在另一個說明中,UseShellExecute屬性是混合大小寫的,因此是私有的。在命令行上設置它可能對靜默安裝沒有任何影響。 –

+1

感謝您的建議。如果您有興趣,請查看我接受的答案。我們正在使用本地VS2010部署項目來創建MSI。我們的需求是在我們的應用程序構建完成後自動部署到alpha環境中。當我使用GUI運行安裝程序時,MSI運行良好,並且據我所見,它需要我的問題中列出的參數。我需要添加UseShellExecute屬性來允許設置一些參數,因爲沒有它的安裝失敗。 –

回答

0

好像我的問題涉及到我沒有正確指定數據庫路徑。 我最終在我的代碼中添加了一個助手,以此類推。

中發現的各種解決方案,在SO(this讓我在正確的方向思考),&我也裝了一些所謂IIS Metabase Explorer這是非常有用的

//Added for reference purposes 
//HasRequiredOption("site|s=", "The site location", c => 
//AddOrUpdateAdditionalMsiProperty("TARGETSITE", BuildMetabasePath(c))); 

//apppool => TARGETAPPPOOL 
//virtualdir => TARGETVDIR 

/// <summary> 
/// Builds the meta-base path. 
/// </summary> 
/// <param name="websiteName">Name of the website.</param> 
/// <returns>The fully constructed meta-base path</returns> 
private string BuildMetabasePath(string websiteName) 
{ 
    return "/LM/W3SVC/" + this.GetWebSiteId(websiteName); 
} 

/// <summary> 
/// Gets the web site id. 
/// </summary> 
/// <param name="websiteName">Name of the website.</param> 
/// <param name="serverName">Name of the server. Defaults to: localhost if none specified</param> 
/// <returns>The website id</returns> 
private string GetWebSiteId(string websiteName, string serverName = "localhost") 
{ 
    using (var entries = new DirectoryEntry(string.Format("IIS://{0}/w3svc", serverName))) 
    { 
     var children = entries.Children.Cast<DirectoryEntry>(); 
     var sites = 
      (from de in children 
      where 
      de.SchemaClassName == "IIsWebServer" && 
      de.Properties["ServerComment"].Value.ToString() == websiteName 
      select de).ToList(); 

     if (sites.Any()) 
     { 
      return sites.First().Name; 
     } 
    } 

    return "-1"; 
} 
工具是您使用的生成此MSI