【问题标题】:ASP.Net core failed to publish on IIS. Error 502.5: 0x80004005 : c0000135ASP.Net 核心无法在 IIS 上发布。错误 502.5:0x80004005:c0000135
【发布时间】:2017-06-16 07:00:28
【问题描述】:

早上好,

我开发了一个使用 VS 2015 发布的新 ASP.Net Core 网站,该网站在我的本地 IIS 上发布时可以在 preprod 中使用,但在我的公司 IIS 服务器上发布时无法使用。 与我的 IT 管理员一起,我们已经完成了此处列出的所有不同步骤:https://docs.microsoft.com/en-us/aspnet/core/publishing/iis 并尝试了解决方案:ASP.NET Core 1.0 on IIS error 502.5

  • 安装出现的 ASP.Net core windows hosting bundle 1.1.0 现在在模块中
  • 重启 IIS
  • 检查用户身份是否可以访问 dotnet.exe 应用程序池
  • 检查 dotnet.exe 是否可以在 PATH 设置中访问
  • 检查.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 会暗示什么?

干杯

西尔万

【问题讨论】:

  • asp.net 注册到您的 IIS 服务器了吗?目录浏览是否启用?
  • 感谢@mark-spencer,我尝试了您的提示但没有成功,我还更新了我的应用程序以使用 Microsoft.NETCore.App 1.1.0 以符合 ASP.Net 核心 Windows 托管在 IIS 上安装了 bundle 1.1.0 但仍然是 502.5 错误....
  • 我也会尝试在该机器上使用 dotnet 从命令行运行网站。如果它运行,那么你的机器上的网络框架或权限有问题。

标签: iis asp.net-core


【解决方案1】:

我遇到了同样的错误,通过安装 Microsoft Visual C++ 2015 Redistributable Update 3 解决了。

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

从 [?9] 加载 dll 失败,HRESULT: 0x80070057

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

安装了 KB2999226 和 KB3118401 - 它没有帮助。我使用的是 Windows Server 2008 R2。

Prerequisites for .NET Core on Windows

【讨论】:

  • 安装 KB2999226 和 KB2533623 帮助我克服了这个问题。希望它可以帮助某人。
【解决方案2】:

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

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

这对我有用。

【讨论】:

    猜你喜欢
    • 2016-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-05
    • 1970-01-01
    相关资源
    最近更新 更多