首页 文章

ASP.Net 核心无法在 IIS 上发布。错误 502.5:0x80004005:c0000135

提问于
浏览
2

早上好,

我开发了一个使用 VS 2015 发布的新的 ASP.Net Core 网站,该网站在我的本地 IIS 上发布时可以在 preprod 中运行,但在我公司的 IIS 服务器上发布时却没有。我的 IT 管理员已经完成了这里列出的所有不同步骤:https://docs.microsoft.com/en-us/aspnet/core/publishing/iis并尝试了解决方案:ASP.NET 核心 1.0 对 IIS 的错误 502.5

  • 安装现在出现在模块中的 ASP.Net 核心窗口托管包 1.1.0

  • 重启 IIS

  • 检查 dotnet.exe 是否可以访问应用程序池的用户标识

  • 检查 PATH 设置中是否可以访问 dotnet.exe

  • 检查.UseIISIntegration()是我的 program.cs

但我们仍然有错误

failed to start process with commandline '"dotnet" .\WebApplication.dll', ErrorCode = '0x80004005 : c0000135.

我的 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=".\WebApplication3.dll" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
  </system.webServer>
</configuration>

我的 appsettings.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "XXXXXXXXXXXXXXXX"
  },
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Debug",
      "System": "Information",
      "Microsoft": "Information"
    }
  }
}

和我的 project.json:

{
  "userSecretsId": "aspnet-WebApplication3-XXX",

  "dependencies": {
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.1",
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": {
      "version": "1.1.0",
      "type": "build"
    },
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    },
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0"
  },

  "tools": {
    "BundlerMinifier.Core": "2.2.306",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "netcoreapp1.1": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "**/*.cshtml",
      "appsettings.json",
      "web.config"
    ]
  },
  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

你有其他建议吗? c0000135 会建议什么?

干杯

西尔

2 回答

  • 0

    我有同样的错误,通过安装Microsoft Visual C 2015 可再发行组件更新 3修复。

    之后我又得到了一个错误:

    无法从[3]加载 dll,HRESULT:0x80070057

    找到了库 hostfxr.dll,但从 C:\ Program Files\dotnet\host\fxr\2.0.7\hostfxr.dll 加载它失败了

    安装KB2999226KB3118401 - 它没有帮助。我使用的是 Windows Server 2008 R2。

    Windows 上.NET Core 的先决条件

  • 0

    为了解决这个问题,我将这些行添加到.csproj 文件中

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

    这适合我。

相关问题