'WebView2 Environment Exception on application hosted on a network (Requested resource is in use)
I am unable to show more than one WebView2 control in an application hosted on a network shared folder.
Let me say straight out of the bat that the solutions disused here (including Microsoft article) do not work:
WebView2 Environment Exception (Requested resource is in use)
absolutely do not fix this issue.
The application binaries is hosted on a server, with multiple users launching the application from that single location. Once one user has WebView2 displayed, another user on the network gets the exception.
As you can see in the code snippet, I am creating subfolders for each users session (this has been tested as is working as expected) :
var dataFolder = @"\\someserver\SomeApplicationFolder";
var subfolder = Guid.NewGuid().ToString();
var di = Directory.CreateDirectory(Path.Combine(dataFolder, subfolder))
var fullpath = dataFolder + @"\\" + subfolder;
var env = await CoreWebView2Environment.CreateAsync(userDataFolder: fullpath);
await webView2ReportServer.EnsureCoreWebView2Async(env);
It possible the locks happen on files in the folder "MyApplication.exe.WebView2" which is in the applications binaries folder on the single network share. But I do not want to install the binaries on each individual client's PC as this is bad practice and not desired architecture.
Solution 1:[1]
One way i found is to copy the exe file and run each of them on the different computers...
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Cyril973 |