ASP.NET 核心 0x80004005 [英] ASP.NET Core 0x80004005

查看:55
本文介绍了ASP.NET 核心 0x80004005的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 ASP.NET Core 的新手,我正在尝试将基本的 ASP.NET Core Web 应用程序部署到 Windows 2012 R2 服务器.

I am new to ASP.NET core and I am trying to just get the basic ASP.NET Core Web Application to deploy to a Windows 2012 R2 server.

我可以使用 Visual Studio express 在本地构建和运行项目,但是当我部署到服务器时出现 502.5 错误,确切的代码是 (0x80004005).

I can build and run the project locally using Visual Studio express but when I deploy to the server I get a 502.5 error, the exact code is (0x80004005).

日志文件为空白,事件查看器仅提供上述错误代码以外的信息.

The log files are blank and the Event Viewer gives no more information than just the above error code.

我怀疑我的 Project.json 文件有问题,如下所示:

I suspect there is something wrong with my Project.json file which looks like this:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.1",
      "type": "platform"
    },
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.1",
    "Microsoft.AspNetCore.Routing": "1.0.1",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "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": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

这是 Visual Studio 生成的默认 project.json 文件.

This is the default project.json file generated by Visual Studio.

推荐答案

原来是需要安装一些windows更新导致这个问题:

Turns out that this was result of needing to install some windows updates and this problem:

打开 Microsoft Office 文件时缺少 api-ms-win-crt-runtime-l1-1-0.dll

我没有安装上述问题中讨论的版本,而是进入了程序和功能,并在 Microsoft Visual C++ 2015 Redistributable 上进行了修复.

Rather than install the version discussed in the above issue I whet into Programs and Features and ran a repair on Microsoft Visual C++ 2015 Redistributable.

我发现这个错误的方法是通过执行以下步骤将网站转换为独立的可执行文件:

The way I found this error was to convert the website to a standalone executable by performing the following steps:

在 project.json 中从依赖项中删除 "type":"platform":

In project.json remove "type":"platform" from the dependencies:

"dependencies": {
"Microsoft.NETCore.App": {
  "version": "1.0.1"     
},

然后定义 Windows 12 R2 运行时:

Then define the Windows 12 R2 runtime:

"runtimes": {
   "win81-x64": {}
},

然后在网站文件夹(包含 project.json 文件的文件夹)中从命令提示符运行以下命令:

Then in the Website folder (the folder containing the project.json file) run the following commands from the command prompt:

dotnet build -r win81-x64
dotnet publish -c release -r win81-x64

独立应用程序应在文件夹 inRelease etcoreapp1.1win81-x64 中创建.

The standalone app should be created in the folder inRelease etcoreapp1.1win81-x64.

将其复制到服务器然后运行它,应该会出现一个对话框,其中包含类似于缺少 api-ms-win-crt-runtime-l1-1-0.dll"的消息.

Copy this to the server and then run it, a dialog should appear with a message similar to "api-ms-win-crt-runtime-l1-1-0.dll is missing".

从那里谷歌!

完成所有这些之后,我就可以从 IIS 运行我的网站了.

After doing all this I was able to run my Website from IIS.

这篇关于ASP.NET 核心 0x80004005的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆