Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET Core 2.0 on IIS error 502.5

I install .net core 2.0 to my windows server 2008 I have two web project. Both of them work in my PC. But when I publish to my server one project work very well but other give that error

HTTP Error 502.5 - Process Failure

Application 'MACHINE/WEBROOT/APPHOST/KI-TAP.COM' with physical root 'C:\HostingSpaces\Reseller1\ki-tap.com\wwwroot\' failed to start process with commandline 'dotnet .\ki-tap.dll', ErrorCode = '0x80004005 : 8000808c.

I update my windows server but it still gives the same error.

here is my program.cs (I didn't add code here. This is default)

  public class Program
    {
        public static void Main(string[] args)
        {
            BuildWebHost(args).Run();
        }

        public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>()
                .Build();
    }

and here is my web.config (published and default code )

<?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=".\ki-tap.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" />


  </system.webServer>
</configuration>

and here is my startup.cs(I added session configuration)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace ki_tap
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddSession();

        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseSession();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
    }
}

Edited: with @set suggestion, I run that command in windows server 2008 in cmd console

C:\Program Files (x86)\dotnet\dotnet myProjectPath\project.DLL

it gives the below error. What should I do?

 package: 'Microsoft.AspNetCore.Antiforgery', version: '2.0.1'
 path: 'lib/netstandard2.0/Microsoft.AspNetCore.Antiforgery.dll'
his assembly was expected to be in the local runtime store as the application
s published using the following target manifest files:
 aspnetcore-store-2.0.3.xml
like image 456
user1688401 Avatar asked Nov 28 '17 15:11

user1688401


People also ask

What is IIS 502.5 error?

23 all return 502.5 IIS Error. HTTP Error 502.5 - Process Failure. Common causes of this issue: The application process failed to start. The application process started but then stopped.


1 Answers

You may have the same problem as described here in aspnet/IISIntegration repo. The solution is to add the following into .csproj file:

<PropertyGroup>
   <PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>

And in general, the source of this problem is that the dotnet version on your local computer and the dotnet version on the server are different.

like image 102
Set Avatar answered Sep 18 '22 17:09

Set