错误502.5 - 进程失败ASP.NET Core 1.1

时间:2017-11-29 15:05:04

标签: c# asp.net asp.net-core webdeploy

我在部署ASP.NET Core Web应用程序时遇到此错误。我做了以下事情:

  • 启用Web服务器(IIS)角色并建立角色服务。
  • 安装.NET Core Windows Server Hosting捆绑包v2.0.3
  • 重新启动系统或执行net stop was /y,然后执行net start w3svc

这是我的csproj文件:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp1.1</TargetFramework>
    <PreserveCompilationContext>true</PreserveCompilationContext>
    <AssemblyName>MyWebApplication</AssemblyName>
    <OutputType>Exe</OutputType>
    <PackageTargetFallback Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AutoMapper" Version="6.1.1" />
    <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="2.0.1" />
    <PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
    <PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.2" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
    <PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
    <PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
    <PackageReference Include="System.Runtime.Serialization.Json" Version="4.3.0" />
    <PackageReference Include="Telerik.UI.for.AspNet.Core" Version="2017.2.621" />
  </ItemGroup>

  <PropertyGroup>
   <UserSecretsId>8844d677-223b-4527-a648-387a65933d55</UserSecretsId>
   <ApplicationIcon>wwwroot\favicon.ico</ApplicationIcon>
  </PropertyGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
  </ItemGroup>

  <PropertyGroup Label="Globals">
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
    <Version>1.0.0</Version>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DefineConstants>$(DefineConstants);RELEASE</DefineConstants>
  </PropertyGroup>

</Project>

这是我的web.config文件:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!--
    Configure your application settings in appsettings.json. Learn more at https://go.microsoft.com/fwlink/?LinkId=786380
  -->
  <system.webServer>
    <handlers>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
    </handlers>
    <aspNetCore processPath="C:\Program Files\dotnet\dotnet.exe" arguments=".\MyWebApplication.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>

我在事件查看器中收到此错误:

  

应用程序&#39; MACHINE / WEBROOT / APPHOST / WWW.MYWEBAPP.COM&#39;与身体   root&#39; C:\ inetpub \ www.mywebapp.com \&#39;无法开始进程   命令行&#39; dotnet。\ mywebapplication.dll&#39;,ErrorCode =&#39; 0x80004005:   80008083

2 个答案:

答案 0 :(得分:2)

最有可能的是,你错过了Visual C ++ 2015 Runtime(可用here)。托管软件包尝试在安装过程中下载并安装它,但如果出现网络问题或服务器无法连接到外部(在企业环境中很常见),则它会失败,您需要手动安装它再发行的。

我无法回想起上次遇到此问题时是否需要,但您可能需要重新启动服务器,以防万一。

修改

如果您仍然遇到问题,请尝试通过命令行运行您的应用:

dotnet MyApp.dll

这将让您看到启动时引发的任何异常。

如果收到如下错误:

It was not possible to find any compatible framework version ...

确保您具有应用程序所针对的ASP.NET Core版本的特定运行时。目前,这是2.0.3(适用于所有2.X应用)或LTS 1.1.5(适用于所有1.X应用)。您可以找到最新的运行时here

答案 1 :(得分:0)

我发现同样的问题,但我的目标框架工作是 netcoreapp2.0 ,我通过使用自包含部署解决了它,而不是每个Microsoft文档的第三方依赖项。我曾经使用目标框架 netcoreapp1.0 ,它可以使用相同的方法解决。

See here solution