Method not found: '!! 0 [] System.Array.Empty () '

I created a new application with VS 2015 RC and the MVC pattern and without changing any line of code. I have this error:

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 

This is the first time this happens to me, so I'm stuck right now

+100
c # asp.net-mvc asp.net-mvc-3
Jul 6 '15 at 19:10
source share
9 answers

I had this situation on the production server, while everything was in order on the development machine.

Installing the .NET Framework 4.6 on the target machine fixed the problem.

+194
Aug 18 '15 at 15:00
source share

Sorry for being late to the party, but in case someone else gets this problem through the TeamCity build, I can describe what we had to do.

.NET 4.6 was installed on our build server (but not on the application server), and RunnerType was Visual Studio (sln), and the Visual Studio option was installed on 2015.

This forced the assembly to use 4.6, and I needed to change the Visual Studio parameter to 2013 to force the assembly to use 4.5.2

+22
Feb 12 '16 at 9:22
source share

Just for others faced with this situation:

if you look in the web.config file, you will understand that in the <compilation> tag you have the targetFramework value set in version below 4.6. but in fact, during the build, you published your application through .NET FrameWork 4.6 or higher (corresponds to ASP.NET MVC 4.6 and higher).

So, if you change the targetFramework value to 4.6, the error will change the form to:

The 'targetFramework' attribute currently refers to a version that is later than the installed version of the .NET Framework.

this is a real mistake, and you will get rid of it by installing the appropriate version of the .NET Framework in the production environment of your web application.

+9
Aug 30 '16 at 15:21
source share

I try this solution without success.

The solution for me was in the application pool, turned into 2.0, launched the site in the browser, looked at the error (because the version is incorrect) and returned to 4.0 and "voila", I got it, itโ€™s open on the website.

+1
May 17 '17 at 17:27
source share

In my case, I had a corrupt .NET installation on my Windows Server 2012 R2. I had to install a newer version of .NET (v4.7.1), and the site is now working.

0
Oct 28 '17 at 11:20
source share

In my case, I do not have access to IIS itself, and I had this problem when I used the only method that has nothing special, only things from.net 2.

Solution: I extracted this method and created a class library with.net 2.0, and it works.

0
Jan 10 '18 at 15:15
source share

It may be too late, but I got the same problem and fixed it as shown below. I am using Visual Studio 2015, compiling the configuration in web.config by default points to .NET FrameWork 4.6. I could not just edit the web.config file only. If you cannot install .NET FrameWork 4.6 on the server and your application does not use it.

  1. Go to "Debug"> "[Project Name] Properties"> "Application".
  2. select the .NET Framework 4.5 (or any server that supports and is compatible with your application) from the Target Framwork drop-down list.
  3. Restore again.
0
Jun 21 '18 at 7:34
source share

I downgraded 4.6.x to 4.5.2 and it worked fine.

0
Oct 02 '18 at 9:26
source share

Upgrading to .NET 4.6 did the trick! (Thanks a lot, Andrey Kovalenko!)

0
Dec 12 '18 at 14:57
source share



All Articles