将 Blender 部署到 Azure 应用程序

Deploy Blender to Azure App

我已将 Blender.exe 和所有相关文件复制到 Azure API App,然后尝试使用我的自定义 Python 脚本 运行 它(使用 System.Dianostics.Process ()):

blender.exe --background --python myscript.py

但是无法正常获取运行。请注意,它在我的本地 IIS 中运行良好。

所以问题是 Azure App 是否支持 运行 Blender? (因为 Blender 可能需要有 GPU 支持的机器才能 运行,而 Azure 还不支持 GPU)

如果是,那么如何从 blender.exe 命令中查看什么错误 return? (不幸的是,我无法远程桌面到 Azure Api App 到 运行 命令)

更新:

我可以手动使用 Azure Console 命令行成功 运行 上面的 blender 脚本。 但是当 运行 脚本使用代码 System.Diagnostics.Process() 时,它从 StandardError 流中得到了这个错误:

Fatal Python error: Py_Initialize: can't initialize sys standard streams

OSError: [WinError 6] The handle is invalid

@MinhNguyen,根据 Kudu 的 wiki page,包含 Api 应用程序的 Azure 应用服务不支持使用 GDI+ 的场景,因为 Win32k.sys (User32/GDI32 ) 限制,但 blender 使用 gdi32。所以很遗憾,blender 无法在 Azure Api 应用程序上运行,请考虑 Azure 云服务或 blender 虚拟机。


更新: 正如@MinhNguyen 评论所说,blender 可以在 Kudu 控制台中手动 运行,尽管由于编译 blender 需要 gdi32.lib,blender 似乎可以与 GDI 一起使用。因此,该问题的解决方案是将包 blender.exe 和相关的 python 脚本作为 webjob 到 Azure 上的 运行。