简体   繁体   English

将ASP.NET Core 2.0 API发布到.NET 4.6.x以在IIS中托管

[英]Publishing ASP.NET Core 2.0 API to .NET 4.6.x to host in IIS

I have built an API using ASP.NET Core 2.0 and I am looking to publish it to run and host it in IIS 8 (Windows Server 2012). 我已经使用ASP.NET Core 2.0构建了一个API,并且希望发布它以在IIS 8(Windows Server 2012)中运行和托管它。 I have found the following article that explains publishing it to IIS: 我发现以下文章解释了将其发布到IIS:

https://stackify.com/how-to-deploy-asp-net-core-to-iis/ https://stackify.com/how-to-deploy-asp-net-core-to-iis/

But it requires the .NET Core Windows Server Hosting Bundle to be installed on the hosting machine, which I would prefer not to have to install on the hosting machines. 但是它要求将.NET Core Windows Server主机捆绑包安装在主机上,我希望不必将其安装在主机上。

I am wondering if there is a way to publish the ASP.NET Core 2.0 application to a "pure" .NET 4.6.1 or 4.6.2 application such that I can run it in IIS without having to install additional .NET Core hosting dependencies. 我想知道是否有一种方法可以将ASP.NET Core 2.0应用程序发布到“纯” .NET 4.6.1或4.6.2应用程序,以便我可以在IIS中运行它而不必安装其他.NET Core托管依赖项。 。

Short answer: no. 简短的回答:不。 Your project itself must target the full framework. 您的项目本身必须针对整个框架。 This in effect publishes it for the full framework, since the target affects the build. 实际上,这将在整个框架中发布它,因为目标会影响构建。 The point is that if you're thinking you can keep it targeting .NET Core, but somehow publish to .NET 4.6, no that cannot be done. 关键是,如果您正在考虑可以将其定位为.NET Core,但是以某种方式发布到.NET 4.6,则无法做到。

That said, I think you're going down a bad path. 就是说,我认为您走的路很糟。 The only good reason to target .NET 4.6 is if you need something specific in the full framework that you can't get from .NET Core. 面向.NET 4.6的唯一理由是,如果您需要在整个框架中有一些特定的东西,而您无法从.NET Core获得。 Even if you intend to publish to IIS today, having the ability to publish to Nginx or another webserver, instead, or even to a Mac or Linux is worth its weight in gold. 即使您打算今天发布到IIS,也能够发布到Nginx或其他Web服务器,甚至发布到Mac或Linux都是值得的。 Just install the hosting bundle. 只需安装主机捆绑包。 What's the big deal, anyways? 到底有什么大不了的?

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM