5

I deployed my .NET Core project to Windows Server 2012 R2 64-bit and this happened:

enter image description here HTTP Error 502.5 - Process Failure according to Microsoft guide, they said that it is because of platform conflicts with RID.

(https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x#common-errors)

I had already come through every step in that guide but can not fix it. So anyone knows how to fix this? I would be appreciated if you could. Thank you.

Note: I had already give publish folder full permission and also installed ASPNetCoreModule v2.0, net core sdk 2.0. My IIS version is 8.5.

Here is my .csproj:

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RootNamespace>_MyAppAPI</RootNamespace>
    <AssemblyName>_MyAppAPI</AssemblyName>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DocumentationFile></DocumentationFile>
  </PropertyGroup>

  <ItemGroup>
    <Content Remove="wwwroot\swagger\authen\basic-auth.js" />
    <Content Remove="wwwroot\swagger\ui\custome.css" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Middleware\" />
    <Folder Include="Logs\" />
    <Folder Include="Models\appapi\" />
    <Folder Include="wwwroot\lib\" />
    <Folder Include="wwwroot\logs\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
    <PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Include="wwwroot\swagger\authen\basic-auth.js" />
    <EmbeddedResource Include="wwwroot\swagger\ui\custome.css" />
  </ItemGroup>

</Project>

And web.config after build:

<?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=".\_MyAppAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>
<!--ProjectGuid: 2510f4bb-368b-4ab2-96e1-5d06b14d677e-->

I ran into this: IIS fails to run ASP.NET Core site - HTTP Error 502.5

Seem to be exactly my problem. But I cannot find an .exe file anywhere

TylerH
  • 20,799
  • 66
  • 75
  • 101
Truong Tran
  • 51
  • 1
  • 1
  • 4
  • Can you tell us more about how did you published app? Can you give us csproj? – Ivan Milosavljevic Oct 13 '17 at 05:36
  • @IvanMilosavljevic Hi. I just update my csproj file and also web.config. – Truong Tran Oct 13 '17 at 06:39
  • How do you deploy/publish project? – Ivan Milosavljevic Oct 13 '17 at 06:47
  • @IvanMilosavljevic From visual studio, I publish folder publish output. And then copy all to a new folder called "api" in C:\inetpub\wwwroot. After that I created an website in IIS with physical path is C:\inetpub\wwwroot\api and run from there. – Truong Tran Oct 13 '17 at 06:57
  • Does this answer your question? [IIS fails to run ASP.NET Core site - HTTP Error 502.5](https://stackoverflow.com/questions/41590493/iis-fails-to-run-asp-net-core-site-http-error-502-5) – TylerH Jun 21 '23 at 20:41

4 Answers4

2

Some one may get help from following steps which i have done.

Ensure(while hosting .net core applications in windows server):

  1. Enable IIS
  2. install .net core SDK - corresponding package(2.0/2.1/etc)
  3. install .net core runtime - corresponding package(2.0/2.1/etc)
  4. install .net core windows server hosting - corresponding package(2.0/2.1/etc)
  5. install c++ redistributable file corresponding to visual studio version
  6. create folder under inetpub/wwwroot/
  7. paste your published files into that folder
  8. add application under your Default Website in IIS and give alias and physical path.

Thats it. you can browse your application using server ip/alias name of your project http://192.168.100.10/samplesite

  • The Runtime is already part of the SDK, so no need to install separately. Also, I found I didn't need the C++ redistributable (and read somewhere that it is only needed when there is no Internet connection). Also, all these steps worked on Win7 too. – Evgeni Sergeev Mar 08 '19 at 05:45
  • One more important step: make sure to restart IIS after making any configuration change. (E.g., if it's not restarted after step 8, it fails with some misleading error message.) – Evgeni Sergeev Apr 02 '19 at 16:54
1

Had the same problem, first enable logging in web.config change to:

stdoutLogEnabled="true" 

and make sure you have created "logs" folder in root folder of your published app. Restart IIS site (your web) and check logs, they will tell you what is wrong.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
KaneNo1
  • 11
  • 3
0

Just something to double check, have you set up the default document?

Also, in IIS, you may have to switch the app pool pipeline for this deployment to from integrated to classic and the .NET CLR version to 2.0 if you are running a .net 2.0 project.

Depending on the .net version you are using.

Sonosp
  • 31
  • 3
  • all you need is to install the hosting bundle on windows and deploy your asp net core using Visual studio publish to the a folder in IIS. It will work after – Jackal Apr 25 '19 at 21:57
0

hellow! Prerequisites for .NET Core on Windows:

For Windows 8.1 and earlier versions, or Windows Server 2012 R2 and earlier versions:

Make sure that your Windows installation is up-to-date and includes KB2999226, which can be installed through Windows Update. If you don't have this update installed, you'll see an error like the following when you launch a .NET Core application: The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.

see more: https://learn.microsoft.com/pt-br/dotnet/core/windows-prerequisites?tabs=netcore30