如何发布以框架 net461 为目标的 .NET Core ASP.NET 网站?
How do I publish a .NET Core ASP.NET website that targets framework net461?
我需要发布一个 .NET Core ASP.NET 面向 net461 框架的 IIS 网站。
我试过:
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
输出是完全没问题的。
我使用以下命令发布了一个测试站点:
dotnet publish --configuration Release --output "C:\temp\net461-site"
将 IIS 指向 C:\temp\net461-site
(必须有 web.config
文件),将 App Pool CLR 版本更改为 No Managed Code
,站点正常运行。
我需要发布一个 .NET Core ASP.NET 面向 net461 框架的 IIS 网站。
我试过:
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
输出是完全没问题的。
我使用以下命令发布了一个测试站点:
dotnet publish --configuration Release --output "C:\temp\net461-site"
将 IIS 指向 C:\temp\net461-site
(必须有 web.config
文件),将 App Pool CLR 版本更改为 No Managed Code
,站点正常运行。