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

1k views Asked by At

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.

enter image description here

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.

0

There are 0 answers