ASP.NET IIS 上的 Core 2.0 错误 502.5
ASP.NET Core 2.0 on IIS error 502.5
我将 .net
核心 2.0 安装到我的 windows 服务器 2008
我有两个网络项目。他们都在我的电脑上工作。但是当我发布到我的服务器时,一个项目工作得很好但其他项目给出了那个错误
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.
我更新了我的 windows 服务器,但它仍然给出同样的错误。
这里是我的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();
}
这是我的 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>
这是我的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?}");
});
}
}
}
已编辑:
有了@set的建议,我运行命令在windows server 2008 in cmd console
C:\Program Files (x86)\dotnet\dotnet myProjectPath\project.DLL
它给出了以下错误。我该怎么办?
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
您可能遇到与 aspnet/IISIntegration 存储库中 here 描述的相同问题。解决方案是将以下内容添加到 .csproj
文件中:
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
而且一般来说,这个问题的根源是你本地电脑上的dotnet版本和服务器上的dotnet版本不一样。
我将 .net
核心 2.0 安装到我的 windows 服务器 2008
我有两个网络项目。他们都在我的电脑上工作。但是当我发布到我的服务器时,一个项目工作得很好但其他项目给出了那个错误
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.
我更新了我的 windows 服务器,但它仍然给出同样的错误。
这里是我的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();
}
这是我的 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>
这是我的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?}");
});
}
}
}
已编辑: 有了@set的建议,我运行命令在windows server 2008 in cmd console
C:\Program Files (x86)\dotnet\dotnet myProjectPath\project.DLL
它给出了以下错误。我该怎么办?
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
您可能遇到与 aspnet/IISIntegration 存储库中 here 描述的相同问题。解决方案是将以下内容添加到 .csproj
文件中:
<PropertyGroup>
<PublishWithAspNetCoreTargetManifest>false</PublishWithAspNetCoreTargetManifest>
</PropertyGroup>
而且一般来说,这个问题的根源是你本地电脑上的dotnet版本和服务器上的dotnet版本不一样。