Question: WebView2 requires elevated mode ?
See original GitHub issueAttempted to create and initialize WebView2
but Access Denied. This code is supposed to work only in elevated mode or a particular Windows policy required?
Issue Analytics
- State:
- Created a year ago
- Comments:21 (2 by maintainers)
Top Results From Across the Web
How to fix msedgewebview2 error in VS2022 when admin?
My best solution so far is to create a shared folder. I decided to make C:\Users\<administrator_user>\AppData\Local\Temp\VSWebView2Cache\ ...
Read more >What Is Microsoft Edge WebView2 Runtime & How to Fix Its ...
# 1. Disable the WebView2 from Task Manager · # 2. Uninstall Microsoft Edge WebView2 Runtime in Silent Mode · # 3. Use...
Read more >Microsoft Edge Webview2 Runtime is a huge problem
Just run this in Powershell (elevated as Admin):winget uninstall "Microsoft Edge WebView2 Runtime". If you want to install it again, ...
Read more >Distribute your app and the WebView2 Runtime
The WebView2 Runtime is a redistributable runtime and serves as the underlying (or backing) web platform for WebView2 apps.
Read more >Visual Studio Windows WebView2 installation error
Go to C:\ProgramData\Microsoft\VisualStudio\Packages , check if a similar or the same package(folder) partly called WebView2 exists. Open it and ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@sigmarsson Creating custom environment options is not currently supported in WinUI. When you do need to specify a custom User Data Foder, @osamu-ikawa’s suggestion of using the environment variable would be the way to do so at this point. Doing it directly via environment options is something we want to support in the future.
About the original issue: the Access Denied error is expected when you use a WebView2 inside a WinUI 3 unpackaged app. This is because the default location of the User Data Folder ends up being in a protected directory, and we can’t create the folder there. Generally you’ll want to handle the user data folder location and cleanup for this type of app. More details and guidance can be found in the Manage user data folders doc. Looks like we need to add a section to the “WinUI 3” tabs to give guidance for unpackaged apps – I think it would look a lot like what’s currently in the “Win32” tabs. I opened an issue to update the doc.
Per my previous comment this still seems to be an issue even when setting the
WEBVIEW2_USER_DATA_FOLDER
environment variable.