2

I am trying to create an Azure function, which takes an url and then returns a screenshot of the page. I have added the package CefSharp.OffScreen.NETCore to the project and the code from CefSharp.MinimalExample for generating a screenshot. Running this in a simple Core console application works as intended, but when run as an Azure Function i get the following error:

System.Private.CoreLib: Exception while executing function: HttpExample. CefSharp.Core: Could not load file or assembly 'CefSharp.Core.Runtime, Version=88.2.90.0, Culture=neutral, PublicKeyToken=40c4b6fc221f4138'. An attempt was made to load a program with an incorrect format. System.Private.CoreLib: An attempt was made to load a program with an incorrect format. (0x8007000B).

stefan
  • 195
  • 1
  • 13
  • Does my answer help? If my reply is helpful, please accept it as answer(click on the mark option beside the reply to toggle it from greyed out to fill in.), see https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work – Doris Lv Mar 22 '21 at 03:29

2 Answers2

1

Sorry I didn't reproduce your issue. As far as I know, Azure Function runs on 32 bit OS, which might not match your assembly.

As you said, your project works well on locally, please check the differences between your local environment and Function App's environment.

Doris Lv
  • 3,083
  • 1
  • 5
  • 14
  • 1
    I am not able to run the function locally. What i have running is a regular console application which takes a screenshot. – stefan Mar 22 '21 at 05:51
0

I am about to implement the same thing now:

enter image description here

I think this may resolve your issue. Only ever run CEF X64

David
  • 693
  • 7
  • 20