.net - 如何发布面向框架 net461 的 .NET Core ASP.NET 网站?

标签 .net asp.net-core .net-core asp.net-core-1.0

我需要为 IIS 发布一个面向 net461 框架的 .NET Core ASP.NET 网站。

我已经尝试过:

dotnet publish --runtime active --output "C:\stuff\" --configuration Release

但这会导致项目输出为.exe(以及 dotnet 核心依赖项的 .dll,如 Microsoft.AspNetCore.Authorization.dll)。我需要发布到 Windows Server 2008 R2 上的 IIS。

"buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true,
    "warningsAsErrors": true
},
"dependencies": {
"Microsoft.AspNetCore.Diagnostics.Elm": "0.1.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Authorization": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Hosting": "1.0.0",
"Microsoft.AspNetCore.Hosting.Abstractions": "1.0.0",
"Microsoft.AspNetCore.Http.Extensions": "1.0.0",
"Microsoft.AspNetCore.Localization": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Routing": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.Session": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Caching.SqlServer": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0"
},

"frameworks": {
    "net461": {}
},

感谢您的帮助!

最佳答案

使用 .Net Core ( Self-contained application ) 获取 IIS 的 exe 输出是完全没问题的。

我使用以下命令发布测试站点:

dotnetpublish--configurationRelease--output“C:\temp\net461-site”

将 IIS 指向 C:\temp\net461-site(必须有 web.config 文件),将应用程序池 CLR 版本更改为无托管代码 并且该网站可以正常工作。

关于.net - 如何发布面向框架 net461 的 .NET Core ASP.NET 网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39729344/

相关文章:

c# - 如何在 C#/.NET 中声明常量?

.net - System.Security.Permissions.DataProtectionPermissionAttribute 的使用

linux - 我如何跨 linux 服务器处理 ValidateAntiForgeryToken

c# - 如何返回带有状态码的响应 JSON 数据?

c# - 在两个 ASP.NET Core 应用程序之间共享 Cookie

c# - 复制内部发布的树后,Docker镜像中缺少DLL

c# - .Net Core Strings.Asc/Mid/Chr/Len 即使在导入 Microsoft.VisualBasic 后也丢失

c# - 如何将C#代码转换为Kotlin的Json库

c# - 在 .NET 4 上运行 .NET 3.5 应用程序时崩溃

.net - 这个项目不知道如何运行配置文件 docker