I am new to ASP.NET core and I am trying to just get the basic ASP.NET Core Web Application to deploy to a Windows 2012 R2 server.
I can build and run the project locally using Visual Studio express but when I deploy to the server I get a 502.5 error, the exact code is (0x80004005).
The log files are blank and the Event Viewer gives no more information than just the above error code.
I suspect there is something wrong with my Project.json file which looks like this:
{
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"type": "platform"
},
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"portable-net45+win8"
]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"**/*.cshtml",
"appsettings.json",
"web.config"
]
},
"scripts": {
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
This is the default project.json file generated by Visual Studio.
Turns out that this was result of needing to install some windows updates and this problem:
api-ms-win-crt-runtime-l1-1-0.dll is missing when opening Microsoft Office file
Rather than install the version discussed in the above issue I whet into Programs and Features and ran a repair on Microsoft Visual C++ 2015 Redistributable.
The way I found this error was to convert the website to a standalone executable by performing the following steps:
In project.json remove "type":"platform" from the dependencies:
Then define the Windows 12 R2 runtime:
Then in the Website folder (the folder containing the project.json file) run the following commands from the command prompt:
The standalone app should be created in the folder \bin\Release\netcoreapp1.1\win81-x64.
Copy this to the server and then run it, a dialog should appear with a message similar to "api-ms-win-crt-runtime-l1-1-0.dll is missing".
From there google!
After doing all this I was able to run my Website from IIS.
This issue is related to Windows updates - but if you are in a similar environment than I was (where you are unable to just install ALL updates), these are the 2 that fixed the issue for me:
I had the same error in question - and got nasty error message when typing 'dotnet' into CMD:
I solved this by manually installing the following 2 updates on Windows Server 2012 R2 (and the pre-requisites and all the other updates linked - read the installation instructions carefully on the Microsoft website):
Hope this helps someone.