簡體   English   中英

appcmd.exe 命令導致 win_command 模塊出錯

[英]appcmd.exe command causing error in win_command module

我正在嘗試通過使用win_command playbook 將多行命令運行到以下腳本中,以便在 IIS 下進行 urlrewrite https 重定向,但即使我嘗試僅將第一個命令行放入win_command ,它也顯示錯誤:

- name: configure https redirection urlrewrite
  win_command: appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].match.url:"(client*)""
               appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS'].conditions.[input='{REQUEST_FILENAME}',matchType='IsFile']"
               appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS'].conditions.[input='{REQUEST_FILENAME}',matchType='IsDirectory']"
               appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].action.type:"Rewrite""
               appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /"[name='Redirect to HTTPS'].action.url:"client/index.html""

你需要在執行這些命令之前添加一個命令,否則 appcmd 將找不到規則。 我已經測試過並成功了

appcmd.exe set config "site1" -section:system.webServer/rewrite/rules /+"[name='Redirect to HTTPS']"

這是執行結果 網頁配置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM