C# ASP.NET项目中缺少ControllerBase.File

C# ASP.NET项目中缺少ControllerBase.File,c#,asp.net,C#,Asp.net,我正在使用.NETFramework 4.6.1和MVC3项目开发一个旧的ASP.NETWebAPI。问题是我没有文件返回类型,不是System.IO中的返回类型,而是控制器中的返回类型。 例如,在ASP.NET Core中,该文件位于ControllerBase类中。因此,由于我的项目只知道System.IO.File,因此在编写以下代码时,我会出现以下错误: 代码: return File(memory, mimeType, document.Name); Provides static

我正在使用
.NETFramework 4.6.1
和MVC3项目开发一个旧的ASP.NETWebAPI。问题是我没有文件返回类型,不是System.IO中的返回类型,而是控制器中的返回类型。 例如,在ASP.NET Core中,该文件位于ControllerBase类中。因此,由于我的项目只知道
System.IO.File
,因此在编写以下代码时,我会出现以下错误:

代码:

return File(memory, mimeType, document.Name);
Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of a FileStream objects.
Non-invocable member 'File' cannot be used like a method.
Method, delegate or event is expected.
错误:

return File(memory, mimeType, document.Name);
Provides static methods for the creation, copying, deletion, moving, and opening of a single file, and aids in the creation of a FileStream objects.
Non-invocable member 'File' cannot be used like a method.
Method, delegate or event is expected.
那么,有没有办法在我的项目中获取这个“文件”?
谢谢你们

你能告诉我们你的控制器类是如何定义的吗?这就是你想要的吗?@MatteoUmili,所以我的控制器是这样定义的:`[webapioauthorize]公共类NetworkController:BaseApiController{…}`而BaseApiController是这样定义的:
公共抽象类BaseApiController:ApiController{…}
@mjwills,谢谢你的回答。是的,作为一种解决方法,我的函数有一个HttpResponseMessage返回类型,如提供的链接中所示。但是,我更喜欢使用ActionResult返回类型,并返回一个“ControllerBase.File”结果。问题来了,ControllerBase.File不存在。@FMR我真的很抱歉,我不明白你的评论给这篇文章带来了什么价值。