【问题标题】:Failed to process input: The parameter must begin with a / or -处理输入失败:参数必须以 / 或 - 开头
【发布时间】:2022-12-10 00:35:40
【问题描述】:

我正在运行一个 Dockerfile,但每次它都会在某一点停止。

RUN powershell %windir%\system32\inetsrv\appcmd.exe set config /section:system.webServer/handlers /+"[name='Test',path='Test.cgi',verb='*',modules="IsapiModule",scriptProcessor="c:\Test.dll",resourceType="Unspecified", preCondition="bitness64"]"


Failed to process input: The parameter 'verb=*' must begin with a / or -

我挣扎了几个小时。可能是什么原因?

【问题讨论】:

  • 看起来您需要在 verb='*' 之后的参数中转义所有双引号。不熟悉 appcmd,但您可以尝试用单引号替换这些引号(如modules='IsapiModule'),用反斜杠转义它们(如modules=\"IsapiModule\"),甚至可能加倍(如modules=""IsapiModule""

标签: docker powershell iis


【解决方案1】:
  • 您正在尝试调用appcmd.exe通过 PowerShell(powershell.exe),尽管 appcmd.exe 命令行不需要该 shell 的功能 - 它似乎仅由文字字符串组成。

  • 您使用 %windir% 意味着您的 Dockerfile 使用默认Windows 上的 shell,即 cmd.exe

因此,您应该能够像从 cmd.exe 会话中提交一样制定您的 appcmd.exe 命令行:

RUN %windir%system32inetsrvppcmd.exe set config /section:system.webServer/handlers /+[name='Test',path='Test.cgi',verb='*',modules='IsapiModule',scriptProcessor='c:Test.dll',resourceType='Unspecified',preCondition='bitness64']

笔记:

  • 为了保持一致性,以/+ 开头的参数其余部分中的所有引用现在仅使用'...';因为没有内部参数 " 字符。因此在发挥作用时,需要逃脱他们走了。

  • 参数的其余部分不允许有空格。

【讨论】:

    猜你喜欢
    • 2018-08-05
    • 2017-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多