未find方法:'!! 0 System.Array.Empty()'。 ASApp.BundleConfig.RegisterBundles(BundleCollection包)inBundleConfig.cs

我用VS 2015 RC和MVC模板创build了一个新的应用程序,并且没有修改任何代码行我有这个错误:

Method not found: '!!0[] System.Array.Empty()'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.MissingMethodException: Method not found: '!!0[] System.Array.Empty()'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [MissingMethodException: Method not found: '!!0[] System.Array.Empty()'.] SAASApp.BundleConfig.RegisterBundles(BundleCollection bundles) in C:\Proyectos\SAASApp\SAASApp\App_Start\BundleConfig.cs:29 SAASApp.MvcApplication.Application_Start() in C:\Proyectos\SAASApp\SAASApp\Global.asax.cs:18 [HttpException (0x80004005): Method not found: '!!0[] System.Array.Empty()'.] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +483 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +118 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +176 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +350 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +305 [HttpException (0x80004005): Method not found: '!!0[] System.Array.Empty()'.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +661 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +96 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +189 

第一次发生在我身上,所以我现在被卡住了

我在生产服务器上有这种情况,而在开发机器上一切正常。

在目标计算机上安装.NET Framework 4.6已解决该问题。

很抱歉迟到了,但是如果别人通过TeamCity构build这个问题,我可以描述我们要做的事情。

.NET 4.6安装在我们的构build服务器(而不是应用程序服务器)上,RunnerType是Visual Studio(sln),Visual Studio选项设置为2015。

这迫使构build使用4.6,我需要将Visual Studio选项更改为2013,以强制构build使用4.5.2

对于面临这种情况的其他人:

如果你看一下web.config文件,你将意识到在<compilation>标签中, targetFramework的值设置为低于4.6的版本。 但事实上,在构build时,您通过.NET FrameWork 4.6或更高版本(对应于ASP.NET MVC 4.6及更高版本)发布了您的应用程序。

所以如果你把targetFramework的值改为4.6,错误会改变成:

“targetFramework”属性当前引用的版本晚于已安装的.NET Framework版本。

这是真正的错误,您将通过在您的Web App的生产环境中安装适当版本的.Net FrameWork来摆脱它。

我尝试这些解决scheme没有成功。

我的解决scheme是去应用程序池,转到2.0,在浏览器上执行该网站,看到错误(因为版本是错误的),并回到4.0和“voilà”,我知道了,网站打开。

就我而言,我在Windows Server 2012 R2上安装了一个损坏的.NET安装。 我必须安装更新版本的.NET(v4.7.1),并且该网站正在运行。