MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: Invalid window handle. (Exception from HRESULT: 0x80070578)

Open
#4,489 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

Hello
I Create Headless WebView2 in WinForm Application
Locally This Application Working Good
When put This program On IIs For Run In Headless Mode Exception :
Invalid window handle. (Exception from HRESULT: 0x80070578)
private IntPtr HWND_MESSAGE = new IntPtr(-3); CoreWebView2Environment webView2Environment = CoreWebView2Environment.CreateAsync(null, AppContext.BaseDirectory + "\\whatsappdata\\" + workingdirectory).GetAwaiter().GetResult(); maincontroller = await webView2Environment.CreateCoreWebView2ControllerAsync(HWND_MESSAGE);
Please Help Thx

Importance

Blocking. My app's basic functions are not working due to this issue.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

No response

SDK Version

No response

Framework

Winforms

Operating System

Windows Server

OS Version

No response

Repro steps

I Use This Code Generate Error
private IntPtr HWND_MESSAGE = new IntPtr(-3); CoreWebView2Environment webView2Environment = CoreWebView2Environment.CreateAsync(null, AppContext.BaseDirectory + "\\whatsappdata\\" + workingdirectory).GetAwaiter().GetResult(); maincontroller = await webView2Environment.CreateCoreWebView2ControllerAsync(HWND_MESSAGE);
Locally Run On Win11 Good But After Run in IIs Mode Exception throw

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

Don't know

Last working version (if regression)

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WinForms/IIS hosting context and the CreateCoreWebView2ControllerAsync(HWND_MESSAGE) call shown in the report. Compare the working Windows 11 execution with the failing Windows Server IIS execution, using the supplied reproduction code. Done means identifying the IIS-specific cause or limitation and documenting actionable guidance for this hosting setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.