locked
Deploy ASP.Net MVC using Web Deploy RRS feed

  • Question

  • User467724963 posted

    I am trying to deploy an asp.net MVC  site to a remote IIS Server. The deployment work fine in Visual Studio but I want to automate it.

    I am using the following MSDeploy Command:

    "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package="SportsStore.WebUI.csproj.zip" -dest:iisApp="Default Web Site/SSBuild",ComputerName="http://r2anet01.eastus.cloudapp.azure.com/MSDEPLOYAGENTSERVICE",UserName='Scott',Password='?????',AuthType='Basic' -allowUntrusted

    MS deploy returns the following error:

    Error Code: ERROR_USER_NOT_ADMIN
    More Information: Connected to 'r2anet01.eastus.cloudapp.azure.com' using the Web Deployment Agent Service, but could not authorize. Make sure you are an administrator on 'r2anet01.eastus.cloudapp.azure.com'. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_NOT_ADMIN.
    Error: The remote server returned an error: (401) Unauthorized.
    Error count: 1.

    I am using the same username/password in MSDeploy that I use in Visual Studio.

    Any help would be appreciated.

    Sunday, January 7, 2018 3:05 PM

All replies

  • User-832373396 posted

    <g class="gr_ gr_10 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="10" data-gr-id="10">Hi</g> <g class="gr_ gr_5 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling ins-del multiReplace" id="5" data-gr-id="5">socamb</g>,

    Sir, I found a  solution, please have a try:

    If you configure delegation to "Allow administrators to bypass rules" and <g class="gr_ gr_184 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" id="184" data-gr-id="184">msdeploy</g> command succeeds, then you are going through WMSvc and it is letting you through. Otherwise, from the <g class="gr_ gr_186 gr-alert gr_gramm gr_inline_cards gr_run_anim Punctuation only-ins replaceWithoutSep" id="186" data-gr-id="186">response</g> it seems that WMSvc is rejecting you and you are falling back to Web Deloy agent.

    Set/add the following reg value to WMSvc reg key:

    reg add HKLM\Software\Microsoft\WebManagement\Server /v WindowsAuthenticationEnabled /t REG_DWORD /d 1

    Recycle WMSvc:

    net stop wmsvc & net start wmsvc

    From https://stackoverflow.com/a/4834248/7349498 

    Reference:

    https://blog.winhost.com/using-msdeploy-to-publish-your-site/ 

    Similar thread :

     https://stackoverflow.com/questions/44395724/msdeploy-401-unauthorized-error-while-msbuild-works-with-same-credentials 

    and if still not working, I suggest that you could ask help from https://forums.iis.net/1144.aspx/1?Web+Deployment+Tool+MS+Deploy+ 

    Good Luck :)

    With regards, Angelina Jolie  

    Tuesday, January 9, 2018 7:14 AM