I am trying to use the CefSharp.OffScreen(41.0.0)
Nuget Package within a WCF Service Application, and I'm getting the following error while trying to run the service from Visual Studio 2013:
Could not load file or assembly 'CefSharp.BrowserSubprocess.Core.DLL' or one of its dependencies. The specified module could not be found.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'CefSharp.BrowserSubprocess.Core.DLL' or one of its dependencies. The specified module could not be found.
The mentioned assembly is present in the project's bin folder as well as all the required assemblies listed on CefSharp's Website. If there is in fact another assembly required I haven't figured out what it is.
A few other points worth mentioning:
CefSharp
works fine when referenced from a Console Application or WPF
Application.Few points,
IIS cannot access Desktop
So you can't run anything that needs a desktop. Your Console and WPF application has access to Desktop and are called user interactive processes.
CEF needs desktop
Cef will need Window manager to create window, without which it cannot render page. This is the reason, the error is misleading here, as IIS cannot load dependent assemblies which require Desktop interaction unless Allow service to interact with Desktop
is selected for IIS process in Windows Services.
Console application is only option with Login
You will have to run your application as console and you will need to login to desktop, allowing IIS to interact with desktop is not a good option and I don't even know what kind of problems it might have.
You can set your server to auto login to some user by modifying registry and set your console application in your startup. So this way everytime server will be restarted, your server will automatically login to specified user and your console app will start. (Windows 8.1 has little difficulty but you will get some solution).
Custom Windows Service with Desktop Access
You can change your application type to Windows Service instead of Console and you can install your windows service that allows access to desktop shown in this article, beware, there are problems that this will work only if somebody is logged on to server.
http://www.codeproject.com/Articles/4891/Interact-With-Desktop-when-Installing-Windows-Serv
PhantomJS headless browser
There is PhantomJS headless browser which you can run in IIS/Windows Service without need to interact with desktop, however you will need to shift your code to JavaScript instead of C#. There are other libraries to manage PhantomJS from your app as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With