The Strange Case of inetmgr.exe.config

Posted by

This post has been republished via RSS; it originally appeared at: IIS Support Blog articles.

One of my customers had a strange issue, whenever they attempted to open the Application Pools node from the IIS Manager GUI,

an alert popped up with an error saying "Could not load file or assembly Microsoft.Web.Configuration.AppHostFileProvider"

 

Untitled.png

 

This was a little strange as it did not affect the w3wp process which we generally troubleshoot but instead the inetmgr GUI itself!

However, as is the case with all assembly loading errors, Fusion Logging was the much needed light in the dark.

 

This is what I see in the Fusion Logs

 

*** Assembly Binder Log Entry  (1/4/2023 @ 10:42:40 AM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Running under executable  C:\windows\system32\inetsrv\InetMgr.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: User = **********
LOG: DisplayName = Microsoft.Web.Configuration.AppHostFileProvider, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35

 (Fully-specified)LOG: Appbase = file:///C:/windows/system32/inetsrv/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : Microsoft.Web.Management, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\windows\system32\inetsrv\InetMgr.exe.Config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config.
LOG: Post-policy reference: Microsoft.Web.Configuration.AppHostFileProvider, Version=10.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35

LOG: The same bind was seen before, and was failed with hr = 0x80070002.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070002).

 

As highlighted, it appears that the AppHostFileProvider is accessible initially, however we see that we use InetMgr.exe.config file

post which there is a failure.

 

Collecting process monitor logs confirms this,

 

4:57:18.1457855 PM      InetMgr.exe       7652       QueryStandardInformationFile                C:\Windows\System32\inetsrv\InetMgr.exe.config          SUCCESS              AllocationSize: 112, EndOfFile: 110, NumberOfLinks: 1, DeletePending: False, Directory: False

 

Digging in further on my local IIS setup, I found that this particular configuration file is not typically present, however I could see

it in the customer's environment. This file is generally present in older versions of IIS and is not currently in use. How it got into the

customer's fairly new setup is still a mystery, but it does not appear to be relevant to their hosting criteria.

 

Upon checking this file, I can see the following

 

Khanita_1-1673371848017.png

 

And it explained everything! It directs the configuration to run under .NET 2.0 instead of 4.0. Hence when we try to access the

above DLLs they are not found and even if we place them there .NET 2.0 cannot load them.

 

On a test environment, we confirmed that this configuration file is not needed as suspected. We changed the name to InetMgr.exe.config.old so that it is no longer used.

 

And the issue was resolved!

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.