【问题标题】:Writing to IIS using Command Line使用命令行写入 IIS
【发布时间】:2013-01-14 10:34:47
【问题描述】:

我正在尝试使用脚本安装应用程序。此应用程序在 IIS 的默认网站下创建一个虚拟目录。 我写了这个脚本。这是正确的脚本还是我遗漏了一些东西。

cd C:\Users\Administrator\Desktop
msiexec /qb /i ZFPSetup.msi INSTALLLOCATION="C:\Program Files (x86)\Application" TARGETVDIR="ZFP" WIXUI_EXITDIALOGOPTIONALCHECKBOX=1 /l*v "C:\log.txt"
iisvdir /create Default Web Site ZFP C:\Program Files (x86)\Application\ZFP 
call "C:\Program Files (x86)\Application\StartKaraf.bat" echo error

我遇到以下错误:

MSI (s) (28:D0) [04:25:58:897]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIF886.tmp, Entrypoint: WriteIIS7ConfigChanges
WriteIIS7ConfigChanges:  Error 0x80070002: Site not found for create application
WriteIIS7ConfigChanges:  Error 0x80070002: Failed to configure IIS application.
WriteIIS7ConfigChanges:  Error 0x80070002: WriteIIS7ConfigChanges Failed.
CustomAction WriteIIS7ConfigChanges returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)

【问题讨论】:

    标签: iis-7 batch-file iis-6 iis-5


    【解决方案1】:

    错误 0x80070002:找不到创建应用程序的站点

    也许这是由于缺少引号引起的,所以而不是:

    ... iisvdir /create 默认网站 ...

    试试:

    ... iisvdir /create "默认网站" ...

    【讨论】:

      【解决方案2】:

      使用简单的批处理文件并不是配置 IIS 的最佳方式。对于此类系统管理任务,Microsoft 创建了PowerShell

      在此处查看如何使用 PowerShell 配置 IIS:http://www.iis.net/learn/manage/powershell

      以下是如何使用 PowerShell 在 IIS 中创建虚拟目录的示例:

      PS IIS:\> New-Item 'IIS:\Sites\Default Web Site\DemoVirtualDir1' -type VirtualDirectory -physicalPath c:\test\virtualDirectory1
      

      上面的代码使用PowerShell Snap-In for Creating Applications

      祝你好运!

      【讨论】:

      • 我不擅长 powershell。我从某个地方得到了这个脚本。如果我必须包含上述功能 + 卸载和安装,我需要对此脚本进行哪些更改。你能帮忙吗?
      • 脚本太长,此处无法通过。你能给我一个powershell脚本吗?
      猜你喜欢
      • 2018-04-18
      • 1970-01-01
      • 2017-12-30
      • 2013-07-04
      • 2011-10-30
      • 1970-01-01
      • 1970-01-01
      • 2011-06-07
      • 1970-01-01
      相关资源
      最近更新 更多