Solved my own issue with getting .NET (core/8.0) API that uses CefSharp running properly on IIS Server (was not initializing web browser) #5007
shiggins-pmc
started this conversation in
General
Replies: 1 comment 1 reply
-
It's not actually headless https://github.com/hardkoded/puppeteer-sharp might be a better choice for your scenario. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
PSA for anyone having issues hosting a CefSharp project from an IIS server, experiencing an issue in which the ChromiumWebBrowser never finishes initializing (but it does initialize in your development environment): You may need to set your IIS Application Pool to "Load User Profile".
You can do so by opening up "Internet Information Services (IIS) Manager" on the server/hosting computer. In the "Connections" pane on the left, expand the server and then click on "Application Pools". In the main window labelled "Application Pools", right-click on the application pool that is running your CefSharp application, then click Advanced Settings. In the Advanced Settings window, find the Load User Model setting under the Process Model section, and set it to TRUE.
More on our problem for context:
Our PDF-generating API (using CefSharp.Offscreen) was working just fine when running locally, but once published to an IIS Server on our Azure virtual machine, it would hang indefinitely while waiting for browser.IsBrowserInitialized to be set to true after instantiating the ChromiumWebBrowser class and creating a browser (automatic by default, or set automaticallyCreateBrowser: false and then use [browserObject].CreateBrowser()). We tried everything we could think of before we eventually tried modifying our server configuration. Hopefully this post helps somebody else out there, as we've been battling this issue for two weeks and were ecstatic to finally find a solution.
The one thing is: I wish that we know WHY this change worked. Does CefSharp require a certain level of permissions to function properly with CEF, or is it something else about the User Model that's needed to make a ChromiumWebBrowser instance? I'd love to understand this better. If anybody has thoughts on the subject, please feel free to comment.
In addition, does anybody know if this is a security risk to allow our application to load a user model? What are the risks involved in doing this?
Beta Was this translation helpful? Give feedback.
All reactions