简体   繁体   English

VSTS msdeploy.exe错误:ERROR_USER_NOT_AUTHORIZED_FOR_CONTENTPATH

[英]VSTS msdeploy.exe error: ERROR_USER_NOT_AUTHORIZED_FOR_CONTENTPATH

I'm trying to create a release definition inside VSTS to deploy my ASP.NET Core 2.0 app on my production server. 我正在尝试在VSTS中创建一个发布定义,以将我的ASP.NET Core 2.0应用程序部署到生产服务器上。

I'm using the MSDeployAllTheThings extension: https://marketplace.visualstudio.com/items?itemName=rschiefer.MSDeployAllTheThings 我正在使用MSDeployAllTheThings扩展: https : //marketplace.visualstudio.com/items ? itemName = rschiefer.MSDeployAllTheThings

I'm able to deploy inside Visual Studio using the same configuration... 我可以使用相同的配置在Visual Studio中部署...

VSTS Config (not working) VSTS Config(不起作用)

在此处输入图片说明

VSTS Error VSTS错误

在此处输入图片说明

Visual Studio Config (working) Visual Studio Config(正在运行)

在此处输入图片说明


Do you guys have any ideas how to do that? 你们有什么想法吗?

Not familiar with smarterasp.net. 不熟悉smarterasp.net。 But this should be an issue with that site. 但这应该是该站点的问题。

If you run the same msdeploy command from your local machine manually, you will get the same error message. 如果您从本地计算机手动运行相同的msdeploy命令,则会收到相同的错误消息。 We didn't see this error when use the same command to deploy to some other host instead of smarterasp.net. 使用同一命令而不是smarterasp.net部署到其他主机时,我们没有看到此错误。 And if you add "-verbose" in the command, you will get a more detailed information which indicates that the command failed to adding the virtual path: 并且如果在命令中添加“ -verbose”,您将获得更详细的信息,该信息表明该命令无法添加虚拟路径: 在此处输入图片说明

When you deploy your project from VS, it use the manifest file and source folder directly rather than "package" method. 从VS部署项目时,它直接使用清单文件和源文件夹,而不是“打包”方法。 So you'd either contact smarterasp.net for help or use the same deploy method as Visual Studio or some other deploy method like FTP. 因此,您可以联系smarterasp.net寻求帮助,或者使用与Visual Studio相同的部署方法,或使用其他部署方法(例如FTP)。

I had the same problem with deployment to smarterasp.net and was able to setup things for Web Deploy: 我在部署到smarterasp.net时遇到了同样的问题,并且能够为Web Deploy设置内容:

  1. Your Dotnet Build task could create deployment package with necessary files like [YourProject].deploy.cmd, [YourProject].zip and etc. For this you could use next Arguments in your Build Task: 您的Dotnet Build任务可以使用必要的文件(例如[YourProject] .deploy.cmd,[YourProject] .zip等)创建部署包。为此,您可以在Build Task中使用下一个Arguments:
--configuration $(BuildConfiguration) /p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactstagingdirectory)\"
  1. Add "Batch script" task and set path to your [YourProject].deploy.cmd in Path field and also in your Arguments: 添加“批处理脚本”任务,并在“路径”字段中以及在“参数”中将路径设置为[YourProject] .deploy.cmd。
/y /m:$(SmarterAspNet.PublishUrl) -AllowUntrusted /u:$(SmarterAspNet.UserName) /p:$(SmarterAspNet.Password) /a:Basic "-setParam:name='IIS Web Application Name',value='$(SmarterAspNet.SiteName)'" -enableRule:AppOffline

With this two main DevOps tasks I was able to deploy my app to smarterasp.net 通过这两个主要的DevOps任务,我能够将我的应用程序部署到smarterasp.net

About MSDeployAllTheThings task: I removed it because it is not needed for me anymore 关于MSDeployAllTheThings任务:我删除了它,因为我不再需要它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM