First request to IIS site always produces 500.21 error

2.4k views Asked by At

I believe this is the reason the 'Application Initialization' module does not work, as it appears the server does not bother to spin anything up until the first request, causing it to fail.

The error produced on every first request is:

HTTP Error 500.21 - Internal Server Error

The specified handler mapping is incorrect.

Detailed Error Information

Module ManagedPipelineHandler

Notification ExecuteRequestHandler

Handler ExtensionlessUrlHandler-Integrated-4.0

Error Code 0x00000000

I have tried the .NET repair instructions here: https://msdn.microsoft.com/en-us/library/hh168535(v=nav.90).aspx

and I've tried uninstalling/reinstalling .NET, but it seems to behave like this no matter what.

The primary reason this is annoying is the website and anything that needs to be started with it will only be started after the 2nd request.

Edit: It might be worth noting that in my "Turn Windows features on or off" menu, I only have an option to enable "ASP.NET" as oppose to "ASP.NET 4.5" as many other posts have suggested would be there. Evidently reinstalling .NET did not make this appear.

2

There are 2 answers

0
user3739346 On

I recently ran into this same issue after changing an application pool from Classic to Integrated Managed Pipeline Mode. I eventually found that this was occurring because the skipManagedModules attribute was set to true in the applicationInitialization element in the web.config file. After removing that attribute, things started working properly.

0
Alexander Trofimov On

I had FileHandler in the handler list that caused your error

applicationInitialization 500.21 error

I added StartupFile handler at top to execute startup page.

<add name="StartupFile" path="/Startup.htm" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="File" requireAccess="Read" />