------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥-------------
本次记录如何设置CefSharp忽略安全证书,以及他的一些其他配置
参考网址:
https://peter.sh/experiments/chromium-command-line-switches/
这个网站记录了CefSharp所有可以设置的配置
http://www.codebye.com/cefsharp-help-2-config-manage.html
这个网站记录了如何具体设置,不过第二个网站在刚才测试中好像没能打开,我简单说一下
具体设置
我在第一个参考网站中找到证书,他有俩个,我不知道哪个起作用,我就都配置了
//安全证书 settings.CefCommandLineArgs.Add("--ignore-urlfetcher-cert-requests", "1"); settings.CefCommandLineArgs.Add("--ignore-certificate-errors", "1");
这是flash的配置
//flash settings.CefCommandLineArgs.Add("ppapi-flash-path", AppDomain.CurrentDomain.BaseDirectory + "\\Plugins\\pepflash\\pepflashplayer.dll");
具体放入的位置,参考我上篇博客的InitializeCefSharp方法里,我写个Demo
/// <summary> /// 解决anycpu不能兼容 /// </summary> [MethodImpl(MethodImplOptions.NoInlining)] private static void InitializeCefSharp() { var settings = new CefSettings(); // Set BrowserSubProcessPath based on app bitness at runtime settings.BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, Environment.Is64BitProcess ? "x64" : "x86", "CefSharp.BrowserSubprocess.exe"); //安全证书 settings.CefCommandLineArgs.Add("--ignore-urlfetcher-cert-requests", "1"); settings.CefCommandLineArgs.Add("--ignore-certificate-errors", "1"); //settings.CefCommandLineArgs.Add("allow-http-background-page", "1"); //settings.CefCommandLineArgs.Add("allow-insecure-localhost","1"); //settings.CefCommandLineArgs.Add("allow-http-screen-", "1"); //settings.CefCommandLineArgs.Add("reduce-security-for-testing", "1"); //flash settings.CefCommandLineArgs.Add("ppapi-flash-path", AppDomain.CurrentDomain.BaseDirectory + "\\Plugins\\pepflash\\pepflashplayer.dll"); // Make sure you set performDependencyCheck false Cef.Initialize(settings, performDependencyCheck: false, browserProcessHandler: null); }