如何在Azure函数中引用CefSharp?

问题描述 投票:0回答:1

我创建了两个项目:第一个是典型的HTTP触发Azure功能,第二个是CefSharp.MinimalExample.OffScreen应用程序的示例。 Azure函数引用CefSharp proj进行截图制作。此引用在本地完善,但在Azure中不适用。发布后,日志流实用程序显示加载程序集'CefSharp.Core.DLL'的问题

2019-04-26T19:09:57.132 [Info,Function1] Function started (Id=1824ad19-be9e-4fd1-a3a4-17e770967164)
2019-04-26T19:09:57.132 [Info,Function1] Executing 'Function1' (Reason='This function was programmatically called via the host APIs.', Id=1824ad19-be9e-4fd1-a3a4-17e770967164)
2019-04-26T19:09:57.132 [Info,Function1] C# HTTP trigger function processed a request.
2019-04-26T19:09:57.148 [Error] A ScriptHost error has occurred
2019-04-26T19:09:57.148 [Error] Could not load file or assembly 'CefSharp.Core.DLL' or one of its dependencies. The specified module could not be found.
2019-04-26T19:09:57.194 [Error,Function1] Exception while executing function: Function1
2019-04-26T19:09:57.194 [Error,Function1] Could not load file or assembly 'CefSharp.Core.DLL' or one of its dependencies. The specified module could not be found.
2019-04-26T19:09:57.194 [Error,Function1] Function completed (Failure, Id=1824ad19-be9e-4fd1-a3a4-17e770967164, Duration=73ms)
2019-04-26T19:09:57.210 [Error,Function1] Executed 'Function1' (Failed, Id=1824ad19-be9e-4fd1-a3a4-17e770967164)
2019-04-26T19:09:57.210 [Error,Function1] Could not load file or assembly 'CefSharp.Core.DLL' or one of its dependencies. The specified module could not be found.
2019-04-26T19:09:57.210 [Error,Function1] Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is '1824ad19-be9e-4fd1-a3a4-17e770967164'
2019-04-26T19:09:57.210 [Error,Function1] Could not load file or assembly 'CefSharp.Core.DLL' or one of its dependencies. The specified module could not be found.
2019-04-26T19:09:57.210 [Error] {"id":"42f419f5-9cc7-4c90-bd6b-92836626c25f","requestId":"213b53eb-ee2c-475e-8094-a9e2ebcb6665","statusCode":500,"errorCode":0,"message":"An error has occurred. For more information, please check the logs for error ID 42f419f5-9cc7-4c90-bd6b-92836626c25f"}
2019-04-26T19:09:57.210 [Error] Could not load file or assembly 'CefSharp.Core.DLL' or one of its dependencies. The specified module could not be found.
2019-04-26T19:09:57.132 [Info] Function started (Id=1824ad19-be9e-4fd1-a3a4-17e770967164)
2019-04-26T19:09:57.132 [Info] C# HTTP trigger function processed a request.
2019-04-26T19:09:57.194 [Error] Function completed (Failure, Id=1824ad19-be9e-4fd1-a3a4-17e770967164, Duration=73ms)

我的项目结构和FTP dll的enter image description here

  • 我用了Release |用于发布的x64(net461)配置,因为x86(System.BadImageFormatException)bla,bla的构建失败。
  • 我略微修改了nuget CefSharp.OffScreen.targets文件并添加了bin文件夹作为CefSharpTargetDir,因为一半的程序集都在bin文件夹之外
  • 我检查了kudu和ftp,D:\ home \ site \ wwwroot \ bin>包含了cefsharp启动所需的所有文件。

有趣的是,如果Azure Webjob(AuthWebjob.csproj)引用Cefsharp一切正常!可能我错过了项目结构或Azure VM的应用程序设置中的某些内容。

c# azure-functions azure-webjobs cefsharp.offscreen
1个回答
-2
投票

使用CefSharp.Core作为本机C ++库,您可以尝试将功能切换到V2并通过FTP将二进制文件复制到wwwroot \文件夹。如果这不起作用,那么恐怕它可能还没有得到支持。我遇到了github问题hereherehere指出了它已被要求但尚未采用的功能。

© www.soinside.com 2019 - 2024. All rights reserved.