Core: Asp.net core 2 deployment to IIS10 (Windows Server 2016)

Created on 5 Sep 2017  路  5Comments  路  Source: dotnet/core

I am getting following error when i tried to publish Asp.net core 2 application to IIS10 on Windows Server 2016.

I build asp.net core 2 project using dotnet publish -c release and that works with dotnet PriceCore.dll

Following is Program.cs file

    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.AspNetCore;
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.Extensions.Configuration;
    using Microsoft.Extensions.Logging;

    namespace PriceCore
    {
        public class Program
        {
            public static void Main(string[] args)
            {
                BuildWebHost(args).Run();
            }

            public static IWebHost BuildWebHost(string[] args) =>
                WebHost.CreateDefaultBuilder(args)
                    .UseKestrel()
                    .UseContentRoot(Directory.GetCurrentDirectory())
                    .UseIISIntegration()
                    .UseStartup<Startup>()
                    .Build();
        }
    }

And following is web.config generated by publish output

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="dotnet" arguments=".\PriceCore.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>

And i am getting following error page.

I also installed URL rewrite module 2 to server and also asp.net core sdk to server.
Can you please suggest where i am doing wrong.

Most helpful comment

All 5 comments

I had similar issue when IIS AppPool allows 32 bit apps on 2012 x64 server. I saw a bunch of URL Redirect fails in system event log while trying to access my site.
as far as i recall (at least in mine case) URL rewrite was 32 bit and for some reason it didn't like it i'm guess. so oddly enough disabling 32bits support in the app pool fixed it.

but i'm still seeing issues with MVC + CORS. it simply doesn't work even so static files are ok

so is there any solution?

@tkggusraqk Thank you actually meanwhile I found the solution and it is exactly what you mentioned, I was missing windows host and it is working now.

@tkggusraqk you save my day, the drawback of Microsoft is when we face common issue, many post on internet related to many version of .NET, products, and choose the right one suit with your problems is too hard.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leo2d picture leo2d  路  3Comments

ffes picture ffes  路  3Comments

lesomnus picture lesomnus  路  3Comments

Rand-Random picture Rand-Random  路  4Comments

AxxlForce picture AxxlForce  路  3Comments