Closed superlit closed 9 years ago
Take a look at the user that your web application is running as, CefSharp is trying to launch a process you need to make sure that the user that your web app is running as is authorized to do so. The standard application pool identity will NOT let you launch a process.
Thanks for your reply. The user is running with all privileges. The error happens when the web application is trying to load the assemblies even if I have no code that uses CefSharp objects!
I'm not really familiar with IIS and its .NET web app runtime environment, so take this with a grain of salt but I'm suspecting it has to do with unmanaged code.
Googled for ".net web application unmanaged" and got http://stackoverflow.com/questions/344608/unmanaged-dlls-fail-to-load-on-asp-net-server
The answers in there has a few possible problem pointers and suggestions to try out.
I'm getting the exact same error trying to use CefSharp.Offscreen in a WCF Service. I tried the suggestions mentioned in jornh's post but nothing worked. Has anyone found any resolution to this? I've tried placing the DLLs in the system32 path, the inetsrv path, and other places.
The problem must be that:
Any help would be greatly appreciated.
The host, IIS Express, is looking in a different location for the DLLS or...
What happens if you change to hosting using IIS
? (Should be easy enough to create a Virtual Directory
)
I've tried to put libcat.dll in the System32 directory and now the HTTP 500 error disappears ("Could not load file or assembly 'CefSharp.BrowserSubprocess.Core.DLL' or one of its dependencies. The specified module could not be found."). I've tried to modify the System variable "Path" adding a custom directory containing libcat.dll and It works too. But now I get another unmanaged error in libcat.dll when I initialize the browser component. It seems there is no way to use carSharp in IIS process :-(
thanks to everyone for the suggestions!
But now I get another unmanaged error in libcat.dll when I initialize the browser component.
At a guess, I'd say it's a threading issue. It's probably worth trying to spawn a single Thread
and perform all the CefSharp
related tasks (including Initialize/Shutdown
). I don't imagine it likes being run on the ThreadPool
@superlit Also can you confirm how your hosting your application? IIS
, IIS Express
?
I'm using IIS 8.5. I tried to create a Single-Threaded Apartments and perform all CefSharp related tasks but It doesn't work.
I tried to create a Single-Threaded Apartments and perform all CefSharp related tasks but It doesn't work.
What does your code look like?
protected HtmlImageDto GetBitmap()
{
Thread thread = new Thread(new ThreadStart(GetBitmapWorker));
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//...
}
private void GetBitmapWorker()
{
Cef.Initialize(new CefSettings());
ChromiumWebBrowser bro = new ChromiumWebBrowser(""); //<-- this throw an exception!
bro.LoadHtml("<html><body>Hello World!</body></html>", "http://www.mysite.com");
Task<Bitmap> task = bro.ScreenshotAsync();
//... wait for screenshot
Bitmap bmp = task.Result;
//...
}
Cef
being multithreaded
by nature, I'm guessing it's not going to like running in STA
.
Scrap that, adding [STAThread]
to the OffScreen
example seems to work ok.
What would be the best way to call CefSharp.Offline from within an IIS hosted web application?
I'm running my web app through an Azure Cloud Service. I'd like to be able to return an image of a screen shot of a specific webpage from my web app. I'm currently using phantomJS but I've found that I can get a 30x performance improvement by using CefSharp so I think it's worth trying to get this to work.
I can run CefSharp.Offline from a backend process outside of IIS, but how would I make calls into that process from my web app? Would NamedPipeServerStream work to communicate between the web app and the console app? I've also seen signalR recommended.
I'm also still stuck on the first error and can't figure out where libcat.dll is coming from that @amaitland used.
Thanks for your help!
I'm also still stuck on the first error and can't figure out where libcat.dll is coming from that @amaitland used.
I think this is a spelling mistake and they meant libcef.dll
.
Hi! I'm copy files to system32 and it's starts good. i tried to create instance Cef.Initialize(new CefSettings()) in separate thread:
Thread tr1 = new Thread(new ThreadStart(CefInit));
tr1.Start();
[STAThread]
void CefInit()
{
Cef.Initialize(new CefSettings());
//ChromiumWebBrowser web01 = new ChromiumWebBrowser("http://www.instagram.com/explore/tags/day"); //<-- this throw an exception!
//web01.LoadingStateChanged += Web01_LoadingStateChanged;
Cef.Shutdown();
}
and has got:
"iisexpress.exe" (CLR v4.0.30319: DefaultDomain)."C:\Users\Gogic\AppData\Local\Temp\Temporary ASP.NET Files\vs\a17045ba\eec5010\assembly\dl3\5bd97149\9f0a43f4_9286d101\CefSharp.Core.DLL". Can't find or open PDB file. Программа "[9832] iisexpress.exe" closed with code -2147483645 (0x80000003).
Any suggestions?
I've never been able to get it working under IIS and nobody has reported back saying they have, so it may not be possible. Use the links above for background info, if you can get it working by all means report back.
Regarding #1646 be patient, you asked your question once, that is enough.
@cybergogic: I've a simliar issue. I'm trying to initialize CefSharp during a Azure Worker Role start up and end up with the error:
The program '[12628] WaWorkerHost.exe' has exited with code -2147483645 (0x80000003).
Steps to reproduce:
Cef.Initialize();
in OnStart()
For future users which might stumble across this issue.
I've found a solution which may work for my use case. I'm using CefGlue and it seems to work with the Azure Worker Role.
I've created a repo with my findings and a small example. https://github.com/Robar666/CefGlueScreenshot
Thanks for sharing, how is the performance? Have you tried using PhantomJS?
On Tue, May 31, 2016 at 9:13 AM, Robar666 notifications@github.com wrote:
For future users which might stumble across this issue.
I've found a solution which may work for my use case. I'm using CefGlue and it seems to work with the Azure Worker Role.
I've created a repo with my findings and a small example. https://github.com/Robar666/CefGlueScreenshot
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cefsharp/CefSharp/issues/1127#issuecomment-222720331, or mute the thread https://github.com/notifications/unsubscribe/ADVbhoYqAqO79_IBkcCA4d_JtfvuxA3Rks5qHFAcgaJpZM4Fagdq .
@twilly86 It works for me, but I have not done any performance testing.
Nope I have tested PhantomJS, since it was no option for me.
Getting the following error when I download the zip and try and build..
[image: Inline image 1]
Error 2 NuGet Package restore failed for project CefGlueScreenshot: Unable to find version '51.1.1' of package 'ChromiumEmbedded.Redistributable-win-x64'.. 0 0
This is the package right?
https://www.nuget.org/packages/cef.redist.x86/3.2526.1362
On Tue, May 31, 2016 at 9:27 AM, Robar666 notifications@github.com wrote:
@twilly86 https://github.com/twilly86 It works for me, but I have not done any performance testing.
Nope I have tested PhantomJS, since it was no option for me.
- No Chromium - at least no official support see ariya/phantomjs#10209 https://github.com/ariya/phantomjs/issues/10209
- .NETWrapper is not open source, at least if you are not paying for it
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/cefsharp/CefSharp/issues/1127#issuecomment-222724738, or mute the thread https://github.com/notifications/unsubscribe/ADVbhh8rgvkY3tiCQsNa3noQ7PVx2Un_ks5qHFNbgaJpZM4Fagdq .
@twilly86 @Robar666 As this discussion is no longer CefSharp
related, please discuss in the CefGlueScreenShot repository.
if I am reading this whole thread correctly, there are several people asking the same thing but after several tried there is no working solution as of now for making Cef Offscreen work with IIS Web App. am I right?
Just for the record, I had this same issue when running my .Net MVC. Solved it by changing this setting: ...x64 in my case, as my MVC is x64
I'm trying to use CefSharp.OffScreen in a x64 Web application but it doesn't work.
This is the error: "Could not load file or assembly 'CefSharp.BrowserSubprocess.Core.DLL' or one of its dependencies. The specified module could not be found."
I've tried with a console application and it works. The same dll/dat/pack copied in to the bin directory of web application cause a crash.
Can CefSharp be used in web applications? thanks