【问题标题】:What is the difference between the these two FileStreamResult from different classes?这两个来自不同类的 FileStreamResult 有什么区别?
【发布时间】:2019-09-11 02:30:41
【问题描述】:

System.Web.MvcFileStreamResultMicrosoft.AspNetCore.MvcFileStreamResult有什么区别?与第一个相比,使用后者有什么重要意义吗?

编辑:

是否有可能拥有.Net Core 项目但仍使用System.Web.Mvc?我不知道怎么做,只是在这里询问可能性,是不是?

【问题讨论】:

  • is it or is not? 不,不是。

标签: c# asp.net-mvc asp.net-web-api filestreamresult


【解决方案1】:

System.Web.Mvc 命名空间用于 .NET Framework。如果您的项目以 .NET Framework 为目标,请使用它。

Microsoft.AspNetCore.Mvc 命名空间用于 .NET Core。如果您的项目面向 .NET Core,请使用它。

根据您的项目,您只能使用其中之一。

可以拥有一个targets the full .NET Framework 的ASP.NET Core 项目,然后直接添加对System.Web.Mvc.dll 的引用。这可能有效。但我不知道你为什么想要。

但是如果你的 ASP.NET Core 项目是针对 .NET Core 的,那么就没有办法使用System.Web.Mvc

【讨论】:

    【解决方案2】:

    System.Web.Mvc 命名空间由 .NET Framework MVC 使用。 Microsoft.AspNetCore.Mvc 由 .NET Core MVC 使用。 Pick appropriatly for the type of project you are building.

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-07-19
      • 1970-01-01
      • 2016-12-22
      • 1970-01-01
      • 2012-06-12
      • 2016-10-06
      相关资源
      最近更新 更多