简体   繁体   English

将 .net core 项目部署到 Windows Server 2012 r2

[英]Deploy .net core project to Windows Server 2012 r2

I deployed my .Net core project to window server 2012 R2 64bit and this happened:我将我的 .Net 核心项目部署到 window server 2012 R2 64bit 并且发生了这种情况:

在此处输入图片说明 HTTP Error 502.5 - Process Failure according to Microsoft guide, they said that it is because of platform conflicts with RID. HTTP 错误 502.5 - 根据 Microsoft 指南处理失败,他们说这是因为与 RID 的平台冲突。

( https://docs.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x#common-errors ) https://docs.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x#common-errors

I had already come through every step in that guide but can not fix it.我已经完成了该指南中的每一步,但无法修复它。 So anyone knows how to fix this?所以有人知道如何解决这个问题吗? I would be appreciated if you could.如果可以,我将不胜感激。 Thank you.谢谢。

Note: I had already give publish folder full permission and also installed ASPNetCoreModule v2.0, net core sdk 2.0.注意:我已经给了发布文件夹完全权限,并且还安装了 ASPNetCoreModule v2.0、net core sdk 2.0。 My IIS version is 8.5.我的 IIS 版本是 8.5。

Here is my .csproj:这是我的 .csproj:

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

  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RootNamespace>_MyAppAPI</RootNamespace>
    <AssemblyName>_MyAppAPI</AssemblyName>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <DocumentationFile></DocumentationFile>
  </PropertyGroup>

  <ItemGroup>
    <Content Remove="wwwroot\swagger\authen\basic-auth.js" />
    <Content Remove="wwwroot\swagger\ui\custome.css" />
  </ItemGroup>

  <ItemGroup>
    <Folder Include="Middleware\" />
    <Folder Include="Logs\" />
    <Folder Include="Models\appapi\" />
    <Folder Include="wwwroot\lib\" />
    <Folder Include="wwwroot\logs\" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0" />
    <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0" />
    <PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
  </ItemGroup>

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Include="wwwroot\swagger\authen\basic-auth.js" />
    <EmbeddedResource Include="wwwroot\swagger\ui\custome.css" />
  </ItemGroup>

</Project>

And web.config after 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=".\_MyAppAPI.dll" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
</configuration>
<!--ProjectGuid: 2510f4bb-368b-4ab2-96e1-5d06b14d677e-->

I ran into this: IIS fails to run ASP.NET Core site - HTTP Error 502.5 Seem to be exactly my problem.我遇到了这个问题: IIS 无法运行 ASP.NET Core 站点 - HTTP 错误 502.5似乎正是我的问题。 But I can not find .exe file anywhere.但我在任何地方都找不到 .exe 文件。 :( :(

Some one may get help from following steps which i have done.有些人可能会从我完成的以下步骤中获得帮助。

Ensure(while hosting .net core applications in windows server):确保(在 Windows 服务器中托管 .net 核心应用程序时):

  1. Enable IIS启用 IIS
  2. install .net core SDK - corresponding package(2.0/2.1/etc)安装.net core SDK - 对应的包(2.0/2.1/etc)
  3. install .net core runtime - corresponding package(2.0/2.1/etc)安装.net core runtime - 对应的包(2.0/2.1/etc)
  4. install .net core windows server hosting - corresponding package(2.0/2.1/etc)安装.net core windows server托管-对应的包(2.0/2.1/etc)
  5. install c++ redistributable file corresponding to visual studio version安装visual studio版本对应的c++可再发行文件
  6. create folder under inetpub/wwwroot/在 inetpub/wwwroot/ 下创建文件夹
  7. paste your published files into that folder将您发布的文件粘贴到该文件夹​​中
  8. add application under your Default Website in IIS and give alias and physical path.在 IIS 中的默认网站下添加应用程序并提供别名和物理路径。

Thats it.就是这样。 you can browse your application using server ip/alias name of your project http://192.168.100.10/samplesite您可以使用项目的服务器 ip/别名浏览您的应用程序http://192.168.100.10/samplesite

Had the same problem, first enable logging in web.config change to:遇到同样的问题,首先在web.config中启用登录更改为:

stdoutLogEnabled="true" 

and make sure you have created "logs" folder in root folder of your published app.并确保您已在已发布应用程序的根文件夹中创建了“logs”文件夹。 Restart IIS site (your web) and check logs, they will tell you what is wrong.重新启动 IIS 站点(您的网站)并检查日志,他们会告诉您出了什么问题。

Just something to double check, have you set up the default document?只是要仔细检查一下,您是否设置了默认文档?

Also, in IIS, you may have to switch the app pool pipeline for this deployment to from integrated to classic and the .NET CLR version to 2.0 if you are running a .net 2.0 project.此外,在 IIS 中,如果您正在运行 .net 2.0 项目,则可能需要将此部署的应用程序池管道从集成切换到经典,将 .NET CLR 版本切换到 2.0。

Depending on the .net version you are using.取决于您使用的 .net 版本。

hellow!你好! Prerequisites for .NET Core on Windows: Windows 上 .NET Core 的先决条件:

For Windows 8.1 and earlier versions, or Windows Server 2012 R2 and earlier versions:对于 Windows 8.1 及更早版本,或 Windows Server 2012 R2 及更早版本:

Make sure that your Windows installation is up-to-date and includes KB2999226, which can be installed through Windows Update.确保您的 Windows 安装是最新的并且包含 KB2999226,它可以通过 Windows 更新安装。 If you don't have this update installed, you'll see an error like the following when you launch a .NET Core application: The program can't start because api-ms-win-crt-runtime-l1-1-0.dll is missing from your computer.如果您没有安装此更新,当您启动 .NET Core 应用程序时,您将看到如下错误:程序无法启动,因为 api-ms-win-crt-runtime-l1-1-0您的计算机中缺少 .dll。 Try reinstalling the program to fix this problem.尝试重新安装程序以解决此问题。

see more: https://docs.microsoft.com/pt-br/dotnet/core/windows-prerequisites?tabs=netcore30查看更多: https : //docs.microsoft.com/pt-br/dotnet/core/windows-prerequisites?tabs=netcore30

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将Visual Studio 2012 ASP.NET(4.5框架)项目部署到Server 2012 R2 Standard - Deploy Visual Studio 2012 ASP.NET (4.5 Framework) project to Server 2012 R2 Standard 在Windows Server 2012 R2上运行Asp.net 5 vNext项目(MVC6)发布生成 - Run Asp.net 5 vNext project (MVC6) publish build on Windows Server 2012 R2 由于 ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY,ASP.NET Core 3.0 应用程序无法在 Windows Server 2012 R2 上运行 - ASP.NET Core 3.0 app not working on Windows Server 2012 R2 due to ERR_HTTP2_INADEQUATE_TRANSPORT_SECURITY Windows Server 2012 r2 中的波斯文化 - Persian culture in Windows Server 2012 r2 经过数日正常运行后,部署在Windows 2012 R2上的.net核心微服务冻结 - .net core microservices deployed on Windows 2012 R2 freezes after days working fine 从Excel读取Windows Server 2012 R2上的.net Windows服务 - .net Windows service on windows server 2012 R2 read from excel 在 Windows Server 2012 R2 中运行针对 .net framework 1.0 构建的 Windows 服务 - Running Windows service built against .net framework 1.0 in Windows Server 2012 R2 Word Documents.Open在ASP.NET Windows Server 2012 R2中返回null - Word Documents.Open returns null in ASP.NET windows server 2012 R2 在Windows Server 2012 R2中使用C#.NET Rest API打印PDF文件时出错 - Error printing PDF file using C# .NET Rest API in Windows Server 2012 R2 Ghostscript.Net在Windows Server 2012 R2中不起作用 - Ghostscript.Net doesn't working in Windows Server 2012 R2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM