Wednesday 23 July 2014

Deploying to Production IIS 8 on Windows 2012

I had problems deploying a new Web application to IIS 8 on Windows 2012.

Firstly the Web site just returned a 404 error. So to increase the verbosity (by following this post) the Web application was reconfigured through web.config:

<configuration>
    <system.webserver>
        <httperrors errormode="Detailed">
    </httperrors>
   </system.webserver>
    <system.web>
        <customerrors mode="Off">
        <compilation debug="true">
    </compilation>
    </customerrors>
    </system.web>
</configuration>

Then an error showed itself:

Detailed Error Information:
Module   IIS Web Core
Notification   BeginRequest
Handler   Not yet determined
Error Code   0x80070021
Config Error   This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
Config File   \\?\C:\inetpub\wwwroot\Monitor Web Site\web.config

This was fixed by running:

%windir%\system32\inetsrv\appcmd.exe unlock config -section:system.webServer/handlers

Then another error showed itself:
HTTP Error 500.21 - Internal Server Error
Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

Most likely causes:
Managed handler is used; however, ASP.NET is not installed or is not installed completely.
There is a typographical error in the configuration for the handler module list.
During application initialization, either the application initialization feature has set skipManagedModules to true, or a rewrite rule is setting a URL that maps to a managed handler and is also setting SKIP_MANAGED_MODULES=1.

This was fixed with this post:
The Web Server (IIS) and Application Server should be installed, and you should also have the optional Web Server (IIS) Support under Application Server.
http://stackoverflow.com/questions/9794985/iis-this-configuration-section-cannot-be-used-at-this-path-configuration-lock

Solution: I had to install "application server" to server roles and add the Web Server IIS support subsection.

No comments:

Post a Comment