我需要爲面向框架net461的IIS發佈.NET Core ASP.NET網站。如何發佈一個面向框架net461的.NET Core ASP.NET網站?
我已經試過:
dotnet publish --runtime active --output "C:\stuff\" --configuration Release
但這會導致該項目被輸出爲.EXE(與DOTNET核心依賴像Microsoft.AspNetCore.Authorization.dll的.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": {}
},
感謝您的幫助!
除了web.config和iis可以使用的一些其他web工件以外,.exe將成爲已發佈內容的一部分。您可能需要添加一些額外的步驟。請參閱[關於發佈到iis的這篇文章](https://docs.asp.net/en/latest/publishing/iis.html)以獲取完整的說明。 –
--output選項存在問題,將其刪除,它將在bin/release/net461/publish發佈 –
@ stephen.vakil是否有將它作爲.dll發佈的問題? 如果我使用framework:netcoreapp1.0,我可以得到一個.dll,但我需要以net461爲目標。 –