运行cefsharp浏览器 [英] Run cefsharp browser

查看:839
本文介绍了运行cefsharp浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用Windows窗体的CefSharp没有成功。该项目编制。但浏览器控件永远不会启动。该日志包括以下两条消息。



[1105 / 111450.741:ERROR:browser_gpu_channel_host_factory.cc(119)]无法启动GPU进程。



[1105 / 111450.835:错误:gpu_process_transport_factory.cc(1027)]丢失的UI共享上下文。



我找不到整个示例项目。我在哪里可以看到或帮助?我正在使用VS2017社区版。



我尝试过:



我试图使用较旧的GitHub版本但没有成功。和X86和X64的不同版本。他们都有同样的问题。

I have no success with the CefSharp with windows forms. The project compiles. But the browser control never launches. The log includes the following two messages.

[1105/111450.741:ERROR:browser_gpu_channel_host_factory.cc(119)] Failed to launch GPU process.

[1105/111450.835:ERROR:gpu_process_transport_factory.cc(1027)] Lost UI shared context.

I can't find a sample project in its entirety. Where can I look or help? I'm using VS2017 community edition.

What I have tried:

I've tried to use older GitHub versions without success. And different builds for X86 and X64. They all have the same problem.

推荐答案

从我记得,这是几年前,我必须确保我的托管应用程序是x86。这是我的初始化序列:



From what I recall, and this is from a few years back, I had to make sure my hosting app was x86. This was my initialization sequence:

Cef.EnableHighDPISupport();
CefSettings settings = new CefSettings();
settings.CachePath = "[somePath]\cache");
settings.RemoteDebuggingPort = 8088;  // If you want to enable remote debugging
Cef.Initialize(settings);
browser = new ChromiumWebBrowser("www.google.com");



并挂钩一些事件并注册.NET对象:


and hooking up some events and registering a .NET object:

browser.FrameLoadEnd += OnPageLoaded;
browser.LoadError += OnLoadError;
browser.ConsoleMessage += OnConsoleMessage;

browser.RegisterJsObject("dotNet", scriptObject);



并且在退出前不要忘记:


and don't forget before you exit:

Cef.Shutdown();





希望有所帮助!



Hope that helps!


这篇关于运行cefsharp浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆