[英]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 核心应用程序时):
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.