Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IIS Deployed ASP.NET 5 BETA 8 site to IIS gives HTTP Error 500.19 - Internal Server Error

I created a new ASP.NET5 Beta 8 Web Application.

I publish it to my local file system and copy those files to my server which is a Windows Server 2012 R2

In IIS 8.5 on the server I create an application that uses an app pool that uses Process Model -> Identity as LocalSystem.

and I point the path to the wwwroot subfolder of the copied published application

My web.config

<configuration>
  <system.webServer>
    <handlers>
      <add name="httpplatformhandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform processPath="..\approot\web.cmd" arguments="" stdoutLogEnabled="false" stdoutLogFile="..\logs\stdout.log" startupTimeLimit="3600"></httpPlatform>
  </system.webServer>
</configuration>

Running the URL on the server directly or clicking browse in IIS

http://localhost/WebApplication1

I get the following error

HTTP Error 500.19 - Internal Server Error

The requested page cannot be accessed because the related configuration data for the page is invalid.

enter image description here

I am using the default web.config from the Visual Studio 2015 ASP.NET 5 Beta8 Web application template so I could only think it's perhaps the .net version.

I used the MSDN method to determine what version of .NET 4 is installed and it corresponds to .NET Framework 4.5.1

In my project.json I have

  "frameworks": {
      "dnx451": { }
  },

I compiled it as Win CLR when publishing

enter image description here

When I go to my approot folder in the deployment directory I can run the web.cmd web server and then access my website through the port created.

http://localhost:5000/

and this site works correctly.

If I view my IIS server roles installed components

enter image description here

ASP.NET 4.5 is installed.

enter image description here

Application pool is correct.

ASP.NET 4 websites run correctly in IIS using the same application pool

My questions 1. Why does IIS say the web.config is invalid? 2. How do I get a ASP.NET 5 Beta 8 site to run in IIS?

like image 745
devfric Avatar asked Oct 20 '15 11:10

devfric


People also ask

How do I fix HTTP error 500.19 internal server error IIS?

The error message itself points out the location of the duplicate entries. To resolve this problem, delete the duplicate entry in the ApplicationHost. config file for the authorization rule.

How do I fix internal server error in IIS?

IIS error The error 500.19 is an internal server error often occurring on a server using Microsoft IIS software. It indicates that the configuration data for the page is invalid. To solve the issue, delete the malformed XML element from the Web. config file or from the ApplicationHost.

How do you fix HTTP error 500.19 Internal server error the requested page Cannot be accessed because the related configuration data for the page is invalid?

Solution. Open IIS Manager, select root node( the hosting server), in the middle panel double click Feature Delegation. In right panel select Custom Site Delegation..., In upper part of middle panel, click the drop down list and select your site. In Action panel click Reset All Delegation.


2 Answers

HttpPlatformHandler is a prerequisite so you need to install it,

https://azure.microsoft.com/en-us/blog/announcing-the-release-of-the-httpplatformhandler-module-for-iis-8/

[Updated: For RC2 and above, a new module is required instead of HttpPlatformHandler, https://github.com/aspnet/Announcements/issues/164 ]

like image 87
Lex Li Avatar answered Sep 20 '22 14:09

Lex Li


The hosting model from ASP.NET 5 Beta 8 has changed and is now dependant on the IIS HttpPlatformHandler.

You will notice your web.config in the wwwroot folder or your application contains references to it.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false" startupTimeLimit="3600"/>
  </system.webServer>

The above %DNX_PATH% translates to "..\approot\web.cmd"

ASP.NET BETA 8 release notes

Hosting ASP.NET 5 applications in IIS will now be achieved using the IIS HttpPlatformHandler configured to forward through to the ASP.NET 5 Kestrel server. The HttpPlatformHandler is a native IIS module that needs to be installed by an administrator on the server running IIS (installers: x86, x64). It’s also already included with the beta8 Web tools update for local development on IIS Express. This native IIS module manages the launching of an external application host process (in this case dnx.exe) and the routing of requests from IIS to the hosted process.

You can install the HttpPlatformHandler using the Microsoft Web Platform installer or separate x86 / x64 installers on download links from Microsoft's IIS site: link.

Take note: The HttpPlatformHandler only supports IIS 8 +. So this means for older operating systems like Windows Server 2008 R2 which comes with IIS 7.5, you won't be able to use IIS to host ASP.NET 5 websites since those version don't support the HttpPlatformHandler.

like image 34
devfric Avatar answered Sep 19 '22 14:09

devfric