如何使用MSDeploy指定目标文件夹

时间:2016-07-15 14:56:57

标签: msdeploy

我让MSDeploy使用像这样的命令成功地将Web包zip文件部署到远程IIS网站

MyDeployCommand.deploy.cmd /T /M:https://MyServer:8172/msdeploy.axd -allowUntrusted   /U:Username /P:Password /A:Basic "-setParam:name='IIS Web Application Name',value='My Website Name'"

虽然这有效,但它默认为网站指向的当前目录。我想改变物理路径。我已经尝试了许多参数但没有成功,并且想知道这是否可行。

感谢chief7指出了appcmd,目标就是这个,例如

%windir%\system32\inetsrv\appcmd set site /site.name:"My Website Name" /application[path='/'].virtualDirectory[path='/'].physicalPath:"C:\new\path"

但是,如果我在远程机器上尝试相同的事情,例如

"%MSDeployPath%msdeploy.exe" -verb:sync -source:runCommand="%windir%\system32\inetsrv\appcmd.exe set site /site.name:;quot;My Website Name;quot; /application[path='/'].virtualDirectory[path='/'].physicalPath:;quot;C:\new\path;quot;",dontUseCommandExe=true -dest:auto

它回来了

错误:系统找不到指定的文件。 (HRESULT的异常:0x80070002)我假设是指appcmd。我添加了

dontUseCommandExe=true

解决通过cmd.exe调用它的问题

1 个答案:

答案 0 :(得分:0)

您可以使用RunCommand提供程序扩展WebDeploy清单以更改站点/应用程序路径。

declare
control number(1);
dup number(10);
res varchar2(5);--TRUE or FALSE

BEGIN
dup :=0;
control :=0;
FOR aRow IN (SELECT MI_PRINX, geoloc,durum, ROWID FROM ORAHAN where durum=0)    
LOOP
 FOR bRow IN (SELECT MI_PRINX, geoloc, ROWID FROM ORAHAN WHERE ROWID>aRow.ROWID AND durum=0)
  LOOP
    BEGIN
       --dbms_output.put_line('aRow' || aRow.Mi_Prinx || ' bRow' || bRow.Mi_Prinx);
    select SDO_GEOM.RELATE(aRow.geoloc,'anyinteract', bRow.Geoloc,0.02) into res from dual;
    if (res='TRUE')
      THEN 
        Insert INTO ORAHANCROSSES values (aRow.MI_PRINX,bRow.MI_PRINX);
        UPDATE ORAHAN SET DURUM=1 where rowid=bRow.Rowid; 
        control :=1;
        --dbms_output.put_line(' added');
    END IF;
    EXCEPTION
      WHEN DUP_VAL_ON_INDEX
        THEN
          dup := dup+1;
          --dbms_output.put_line('duplicate');
          --continue;
    END;
  END LOOP;
  IF(control =1)
    THEN
      UPDATE ORAHAN SET DURUM=1 WHERE rowid=aRow.Rowid;
  END IF;
  control :=0;
END LOOP;
dbms_output.put_line('duplicate: '||dup);
END ;

http://www.dotnetcatch.com/2016/06/28/webdeploymsdeploy-quick-tip-change-iis-siteapp-physical-path-with-msdeploy/

http://www.dotnetcatch.com/2016/05/19/extending-the-webdeploy-manifest/

<runcommand path=&quot;%windir%\system32\inetsrv\appcmd set app /app.name:&amp;quot;Default Web Site/app12&amp;quot; /&#91;path=&#39;/&#39;&#93;.physicalPath:C:\temp\app12&quot; waitInterval=&quot;5000&quot;/> 提供程序也可以让您更改目录,但这更容易。