1

I have an .net core application that uses certain .net framework dlls.For this reason, I had to run .net core on .net framework 4.6.2. It works fine of visual studio 17 but cannot host on IIS server. I am receiving

An error occurred while starting the application.

.NET Framework X86 v4.0.30319.42000
| Microsoft.AspNetCore.Hosting version 1.1.2
| Microsoft Windows 6.1.7601 S

Any suggestion is highly appreciated. Thanks

WorkInProgress
  • 393
  • 6
  • 16
  • 1
    You need to find the error. Should be in the event log. Add it to an [edit]. –  Jul 20 '17 at 17:54
  • 1
    Have a look [here](https://stackoverflow.com/questions/35663759/asp-net-5-an-error-occurred-while-starting-the-application) – Matt Jul 20 '17 at 18:07
  • 1
    You should probably post your .csproj – anserk Jul 20 '17 at 18:58
  • 1
    If you get `startup` errors you can enable extra startup options to output the actual reason. Have a look at my blog post about it. http://pkula.blogspot.co.uk/2017/11/asp-net-core-how-to-fix-error-occurred.html – Piotr Kula Nov 15 '17 at 11:00

2 Answers2

1

Thanks you for you suggestions.

The problem was appsettings.production.json and appsettings.Staging.json. These files were empty.

I am not sure what this was not issue while debugging the application from Visual Studio. Anyway, I add minimal codes to those file to overwrite the appsettings.json and it worked like a charm.

WorkInProgress
  • 393
  • 6
  • 16
0

At lot of things can go wrong with ASP.NET Core. At first, I'll go to server, and see correct version of .NET Core is installed.

C:\Program Files\dotnet\shared\Microsoft.NETCore.App

1.1.2 version should be there. If not, you'll have to install it.

enter image description here

Win
  • 61,100
  • 13
  • 102
  • 181
  • I think he is targeting .Net Framework so he needs to make sure to have the correct version of that. – anserk Jul 20 '17 at 18:58