Zimo
Zimo

Reputation: 342

WebView2 Environment Exception (Requested resource is in use)

I get the following exception when the WebView2 application is launched by more than one user on the server: "Requested resource is in use.(Exception from HRESULT: 0x800700AA)"

The user that launched the application first can still open multiple sessions. How do we allow it to work with multiple users?

The debugger says that the issue is generated by the "EnsureCoreWebView2Async" method. This is how i created the environment:

 var env = await Microsoft.Web.WebView2.Core.CoreWebView2Environment.CreateAsync(userDataFolder: CacheDirectory);
 await this.EnsureCoreWebView2Async(env);

Upvotes: 5

Views: 4388

Answers (1)

Zimo
Zimo

Reputation: 342

The answer is in Microsoft Docs

https://learn.microsoft.com/en-us/microsoft-edge/webview2/concepts/user-data-folder

We can use System.Environment.UserName as a directory name. That way it will keep the environments separate

Keep in mind that the environment directories have to be cleaned up when the application is closed or uninstalled.

Upvotes: 4

Related Questions