错误 - 访问被拒绝 - 部署到 Azure 应用服务

Tom*_*att 5 deployment azure kudu azure-web-app-service asp.net-core

我们通过 KUDU 脚本在 Azure 中使用自动部署过程,今天我们在 Azure 部署中心看到奇怪的错误:

命令dotnet publish(以及“dotnet build”)返回:

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
Unhandled exception. System.ComponentModel.Win32Exception (5): Access is denied.
System.ComponentModel.Win32Exception (5): Access is denied.
   at System.Diagnostics.Process.set_PriorityClassCore(ProcessPriorityClass value)
   at System.Diagnostics.Process.set_PriorityClass(ProcessPriorityClass value)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
   at Microsoft.Build.CommandLine.MSBuildApp.Main(String[] args)
   at System.Diagnostics.Process.set_PriorityClassCore(ProcessPriorityClass value)
   at System.Diagnostics.Process.set_PriorityClass(ProcessPriorityClass value)
   at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
Failed exitCode=-532462766, command=dotnet publish "D:\home\site\repository\
...
Run Code Online (Sandbox Code Playgroud)

细节:

  • KUDU脚本有自动部署过程
  • app 是 .NET Core 应用程序,.csproj 有目标框架:netcoreapp2.2

问题可能出在 Azure 方面,因为我们没有在项目中做任何更大的改变。有没有人有相同/类似的问题?

小智 7

我们遇到了同样的问题,经过调查我们发现:

  • Azure 应用了新的“dotnet”版本 3.1.301,此版本的 SDK 会引发该错误(您可以通过 commnad 'dotnet --version' 检查您的版本)
  • 通过命令 'dotnet --list-sdks' 你可以看到所有已安装的 SDK
  • 然后我们简单地使用以前的版本(在我们的例子中是 v3.1.202)
  • 如何判断 dotnet sdk 的确切版本的最简单方法是通过global.json

示例:global.json

{
  "sdk": {
    "version": "3.1.202"
  }
}
Run Code Online (Sandbox Code Playgroud)

并且文件必须在“工作目录”中,并且KUDU脚本在此处具有工作目录D:\home\site\repository

如果您的部署在以前版本的 dotnet SDK 上没有问题,那么这肯定会有所帮助。