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.
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?
https://www.microsoft.com/net/download/dotnet-core/runtime-2.0.7
download window host
@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.
Most helpful comment
https://www.microsoft.com/net/download/dotnet-core/runtime-2.0.7
download window host