Closed rambouillet closed 2 years ago
cc @joeloff
the hosting bundle only installs ANCM for IIS. ANCM for IIS Express ships only as part of VS. Do you have logs from the hosting bundle install?
@joeloff Apologies, the error started after I updated Visual Studio 2022 from 17.0.1 to 17.1.1
No worries. There should still be logs in your %temp% folder from VS that should help pinpoint why ANCM got removed.
@joeloff I've done several text searches of all my %temp% folder content, and could not find any reference to aspnetcorev2.dll, or anything regarding the removal of the AspNetCoreModuleV2 module.
Today I completely uninstalled all Visual Studio versions, then uninstalled IIS Express. I then confirmed the IIS Express folders were deleted from C:\Program Files
and C:\Program Files (x86)
. I then restarted my PC, and reinstalled Visual Studio using the latest VisualStudioSetup.exe
installer from Microsoft.
I noticed something interesting now, in the applicationhost.config file that got created with this install, it added a module called "AspNetCoreModule".
However, when I reference "AspNetCoreModule" in my web.config, I still get the error:
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.
You can trigger this error message by starting up a new project, and choosing the sample ASP.NET Core Web App (Model-View-Controller) as the template, and choosing "IIS Express" to build and run the application.
I just added a screen recording of the complete replication of the error to the original post above, link to the GIF is here: https://user-images.githubusercontent.com/20598632/159097854-9cb282da-1ec7-43a7-9d66-e269a829c647.gif
once you reinstalled there should be logs from Visual Studio. Look for dd*.log in your temp folder. Alternatively, you can download and run the .NET log collection tool from https://www.microsoft.com/en-ca/download/details.aspx?id=12493
If you don't have IIS enabled (you either need Windows Server or Windows Enterprise for this), but selected the ASP.NET Web Development workload in Visual Studio, it should install IISExpress. If you do have IIS it will enable an additional option called IIS Development, though you have to explicitly select that to get ANCM for IIS instead of ANCM for IIS Express.
@joeloff Here is a log from my reinstall that mentions the addition of "AspNetCoreModule" (missing the "V2" suffix). It appears Visual Studio is looking for "AspNetCoreModuleV2", which is what is causing the error. Furthermore, the DLL that is referenced is "aspnetcore.dll" instead of "aspnetcorev2.dll".
The log filename is dd_setup_20220318173159_245_Microsoft.Ancm.IISExpress.Msi.log
The line in question is this one:
MSI (s) (D8:10) [17:38:26:081]: PROPERTY CHANGE: Adding CA_ADD_MODULE property. Its value is '"C:\Program Files\IIS Express\appcmd.exe" install module /name:AspNetCoreModule /image:"%IIS_BIN%\aspnetcore.dll" /apphostconfig:"C:\Program Files\IIS Express\AppServer\applicationhost.config"'.
The full log is here:
@adityamandaleeka, this should go to someone on the ASP.NET side. I promised @Pilchie I'd help out by looking at setup issues
@rambouillet, looking at the setup authoring in VS it should be installing both ANCM v1 and v2 for IISExpress. Do you have the primary log, based on the log you posted, it should be called dd_setup_20220318173159.log. This log would have the overall planning, detection, etc. of the complete VS install and may shed some light as to why VS did not install ANCM v2. There's no conditions attached to ANCM for IISExpress. The only reason why it would skip a package like this would be if it thinks it's already installed.
@joeloff I accidentally closed the issue. Reopening.
@joeloff Here is the log you asked for. I couldn't copy/paste the text here because it exceed the comment length limit.
Note: I completely uninstalled Visual Studio and IIS Express (using their respective uninstallers) before reinstalling Visual Studio. Before reinstalling, I also confirmed the IIS Express folders in C:\Program Files
and C:\Program Files (x86)
were manually deleted. So, this log should reflect a fresh install of everything. Perhaps it doesn't though.
The logs shows that it has detected an installed copy of ANCM v2:
[2314:000b][2022-03-18T17:32:00] Compatible ProductCode '{5586FE05-A6CA-4216-A8AB-89CEF8DB610F}' found for package 'Microsoft.Ancmv2.IISExpress.Msi,version=17.1.32112.364,chip=x64'
...
[2314:000b][2022-03-18T17:32:01] Package 'Microsoft.Ancmv2.IISExpress.Msi' is found present,doesn't participate in ref count, and manifest is missing, it will be marked as permanent.
...
[2314:000b][2022-03-18T17:32:01] Package: Microsoft.Ancmv2.IISExpress.Msi,version=17.1.32112.364,chip=x64, CurrentState: Absent, RequestedState: Present, DetectionState: Superseded, PlannedAction: None.
[2314:000b][2022-03-18T17:32:01] Dependency action plan - PackageExecuteAction: None, PlannedActionForDependency: Add.
Eventually it ends up classifying the package as superseded so it sets the execution plan to None
. We might be able to forcibly remove this and have VS reinstall it. Do you see anything under this key in the registry?
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Dependencies\IISExpress_AspNetCore_Module_V2,x64
Specifically under the Dependents subkey
The logs shows that it has detected an installed copy of ANCM v2:
[2314:000b][2022-03-18T17:32:00] Compatible ProductCode '{5586FE05-A6CA-4216-A8AB-89CEF8DB610F}' found for package 'Microsoft.Ancmv2.IISExpress.Msi,version=17.1.32112.364,chip=x64'
...
[2314:000b][2022-03-18T17:32:01] Package 'Microsoft.Ancmv2.IISExpress.Msi' is found present,doesn't participate in ref count, and manifest is missing, it will be marked as permanent.
...
[2314:000b][2022-03-18T17:32:01] Package: Microsoft.Ancmv2.IISExpress.Msi,version=17.1.32112.364,chip=x64, CurrentState: Absent, RequestedState: Present, DetectionState: Superseded, PlannedAction: None.
[2314:000b][2022-03-18T17:32:01] Dependency action plan - PackageExecuteAction: None, PlannedActionForDependency: Add.
Eventually it ends up classifying the package as superseded so it sets the execution plan to None
. We might be able to forcibly remove this and have VS reinstall it. Do you see anything under this key in the registry?
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Dependencies\IISExpress_AspNetCore_Module_V2,x64
Specifically under the Dependents subkey
@rambouillet were you able to check the registry for the value @joeloff mentioned above?
@joeloff @wtgodbe Apologies for the late response. Yes, that registry key does have some things. Here is a screenshot of mine:
Should I delete the key IISExpress_AspNetCore_Module_V2,x64
and try reinstalling?
Thank you. That value indicates that one or more instance of VS believes it installed the package. One thing you can try it to forcibly remove it and then repair VS.
msiexec /x {5586FE05-A6CA-4216-A8AB-89CEF8DB610F} IGNOREDEPENDENCIES=ALL
should remove it and then repairing VS should not find that it's installed I think and reinstall it for you
This should be fixed in the May release of 17.1/17.2.
Is there an existing issue for this?
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.
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:
This is the screen that I first got:
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
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" />
: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