I wrote a very detailed article on Windows 11 ARM64 full IIS and ASP.NET Core. But the IIS Express scenario seems to be different.
Will go back to make a complete answer when I have time to finish more investigation.
A few interesting facts so far for future readers,
C:\Program Files\IIS Express\iisexpress.exe
is ARM64X executable.
- ASP.NET Core module files under
C:\Program Files\IIS Express\Asp.Net Core Module\V2\
are pure ARM64.
- Based on the error message posted by you,
C:\Program Files\IIS\Asp.Net Core Module\V2\aspnetcorev2.dll
was likely to be pure ARM64, while the IIS Express worker process seemed to be running as x64.
You will have to provide more information like what exactly you installed on this VM, because
- .NET 5/6 do not have ARM64 support, so installing them only add x64 bits to ``C:\Program Files\IIS\Asp.Net Core Module\V2`. That is contradictory to 3. My guess is somehow you got .NET 7 bits installed.
- Also interesting why your IIS Express worker process tried to load ASP.NET Core module bits from
C:\Program Files\IIS\Asp.Net Core Module\V2
. That makes no sense as if you read C:\Program Files\IIS Express\AppServer\applicationhost.config
(template for VS to create all other config files) it points to C:\Program Files\IIS Express\Asp.Net Core Module\V2
by default. There must be something you didn't reveal before hitting this issue.
You didn't mention the Visual Studio release you were using either. That might also contribute to the problem.