question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IIS Express module "AspNetCoreModuleV2" is removed after installing Visual Studio 17.1.1, breaking IIS Express support

See original GitHub issue

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

In short, IIS Express no longer works with .NET Core applications after installing Visual Studio version 17.1.1. You can easily see this when selecting “IIS Express” as the server to build and run the application from within Visual Studio. You will receive an error message stating:

The ASP.NET Core Module is required to host ASP.NET Core projects in IIS Express and does not appear to be installed. Try repairing Visual Studio to correct the problem.

NOTE: I have tried uninstalling, reinstalling, and repairing Visual Studio 2022, and it does not fix the error. Something in Visual Studio version 17.1.1 removes the ASP.NET Core Module for IIS Express altogether, so no amount of repairing will fix the issue.

buildrunerror

err2

Detailed Info:

When I develop locally for ASP.NET 6, I use IIS Express with a web.config file pointing to my web application’s DLL file. I’ve been doing this for every version of .NET Core. Today however, after upgrading from Visual Studio 17.0.1 to version 17.1.1, I tried starting up my web application the way I always do, but started getting a web.config error (IIS Express is unable to read my web.config file). This is my web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<location path="." inheritInChildApplications="false">
		<system.webServer>
			<handlers>
				<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
			</handlers>
			<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" hostingModel="inprocess" disableStartUpErrorPage="false">
			</aspNetCore>
		</system.webServer>
	</location>
</configuration>

This is the screen that I first got:

01

I noticed after I removed the <aspNetCore> section, I got a more detailed error message:

Handler "aspNetCore" has a bad module "AspNetCoreModuleV2" in its module list

02

So, it looks like the module “AspNetCoreModuleV2” is no longer recognized by IIS Express. To confirm this, I checked IIS Express’s C:\Program Files\IIS Express\AppServer\applicationhost.config file. Sure enough, the “AspNetCoreModuleV2” section was removed from IIS Express’s configuration. Normally, there is a module listed as <add name="AspNetCoreModuleV2" image="%IIS_BIN%\Asp.Net Core Module\V2\aspnetcorev2.dll" />:

03

Expected Behavior

IIS Express’s configuration file located at C:\Program Files\IIS Express\AppServer\applicationhost.config should have a globalModule item called “AspNetCoreModuleV2”, like this:

<add name="AspNetCoreModuleV2" image="%IIS_BIN%\Asp.Net Core Module\V2\aspnetcorev2.dll" />

After the .NET 6.0.3 update, this was removed, breaking IIS Express’s support for ASP.NET 6.0.3 applications.

Steps To Reproduce

Install .NET 6.0.3 and try running a 6.0.3 web application with IIS Express.

Exceptions (if any)

No response

.NET Version

6.0.3

Anything else?

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
joeloffcommented, Mar 22, 2022

@adityamandaleeka, this should go to someone on the ASP.NET side. I promised @Pilchie I’d help out by looking at setup issues

0reactions
wtgodbecommented, Apr 7, 2022

This should be fixed in the May release of 17.1/17.2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

aspnetcoremoduleV2 missing from iis modules after ...
I have done the following and its now working 1- delete the current aspNetCoreModule (I guess this part was unnecessary) 2- install the ......
Read more >
ASP.NET Core Module (ANCM) for IIS
The ASP.NET Core Module (ANCM) is a native IIS module that plugs into the IIS pipeline, allowing ASP.NET Core applications to work with...
Read more >
Asp.net core app with a web.config cannot use IIS Express
The issue is that IIS Express doesn't like that I have one inside my project root. It is picking up on that and...
Read more >
Run and debug ASP.NET Core apps in IIS Express
Running and debugging ASP.NET Core apps in IIS Express only works on Windows. Visual Studio 2019 or later must be installed on the...
Read more >
ASP.NET Core on IIS Express - Empty error starting application
When Visual Studio or Rider launch an ASP.NET Core IIS Express profile, they verify whether an applicationhost.config file exist. If not, they ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found