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.
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
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
ASP.NET 4.5 is installed.
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?
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 ]
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.
My Project uses the: ASP.NET Core Web Application (.NET Framework)
This is because I plan on using IIS and Windows, so no need to go full-on Core.
I found this link: Install the .NET Core Windows Server Hosting Bundle
There you will find this link: .NET Core Windows Server Hosting
The 2nd Link above will automatically try to download and install the "Microsoft .NET Core 1.0.0 Windows Server Hosting" Bundle.
I like the 1st Link because it actually explains why you need it.
Once I installed on my server, my website finally started working!
No more HTTP Error 500.19 :)
I left my app-pool as .net 4 (I did not set it to "No Managed Code") as the instructions say to do. I haven't tried it, but I figured since I chose to use the .NET Framework, that I would still need it.
With ASP.Net Core 1.0 you have to install ASP.NET Core Module
on the IIS host. You can get it here.
https://stackoverflow.com/a/38119924/1821792