简体   繁体   English

IIS上的ASP.NET Core 2.0错误502.5

[英]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. 我安装.net core 2.0到我的Windows Server 2008我有两个web项目。 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 HTTP错误502.5 - 进程失败

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. 物理根目录'C:\\ HostingSpaces \\ Reseller1 \\ ki-tap.com \\ wwwroot \\'的应用程序'MACHINE / WEBROOT / APPHOST / KI-TAP.COM'无法使用命令行'dotnet。\\ ki-tap.dll'启动进程,ErrorCode ='0x80004005:8000808c。

I update my windows server but it still gives the same error. 我更新我的Windows服务器,但它仍然给出相同的错误。

here is my program.cs (I didn't add code here. This is default) 这是我的program.cs (我这里没有添加代码。这是默认的)

  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 ) 这是我的web.config (已发布和默认代码)

<?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) 这是我的startup.cs(我添加了会话配置)

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 编辑:使用@set建议,我在cmd控制台的Windows Server 2008中运行该命令

C:\\Program Files (x86)\\dotnet\\dotnet myProjectPath\\project.DLL 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

You may have the same problem as described here in aspnet/IISIntegration repo. 描述你可能有同样的问题在这里的ASPNET / IISIntegration回购。 The solution is to add the following into .csproj file: 解决方案是将以下内容添加到.csproj文件中:

<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. 一般来说,这个问题的根源是本地计算机上的dotnet版本和服务器上的dotnet版本不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM