Programing

메서드를 찾을 수 없습니다 : '!! 0 [] System.Array.Empty ()'

crosscheck 2020. 7. 23. 08:11
반응형

메서드를 찾을 수 없습니다 : '!! 0 [] System.Array.Empty ()'


VS 2015 RC 및 MVC 템플릿으로 새 앱을 만들었으며 코드 줄을 수정하지 않고이 오류가 발생했습니다.

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 빌드를 통해이 문제를 겪을 경우 우리가해야 할 일을 설명 할 수 있습니다.

.NET 4.6은 응용 프로그램 서버가 아닌 빌드 서버에 설치되었으며 RunnerType은 Visual Studio (sln)이고 Visual Studio 옵션은 2015로 설정되었습니다.

이로 인해 빌드에서 4.6을 사용해야했고 빌드에서 4.5.2를 사용하도록 Visual Studio 옵션을 2013으로 변경해야했습니다.


이 상황에 직면 한 다른 사람들에게만 :

web.config 파일을 보면 <compilation>태그에서 값이 targetFramework4.6 이하로 설정되어 있음을 알 수 있습니다 . 그러나 실제로 빌드시 .NET FrameWork 4.6 이상 (ASP.NET MVC 4.6 이상에 해당)을 통해 응용 프로그램을 게시했습니다.

따라서 값 targetFramework을 4.6으로 변경하면 오류 모양이 다음과 같이 변경됩니다.

'targetFramework'특성은 현재 설치된 .NET Framework 버전보다 최신 버전을 참조합니다.

이것은 실제 오류이므로 웹 응용 프로그램의 프로덕션 환경에 적절한 버전의 .Net FrameWork를 설치하여 제거 할 수 있습니다.


.NET Framework를 최신 (4.7.2)으로 업데이트하면 문제가 해결되었습니다. 솔루션을위한 @Andrey Kovalenko에게 감사합니다.

그러나 오류가 같아서는 안됩니다.

enter image description here

I am not sure telling each customer about updating their .NET Framework is applicable. I had this issue especially at Windows Embedded OS installed system, only at production environment.

Is there any other way to overcome the behavior, from our code base itself.?


I try these solution without success.

The solution for me was go to the application pool, turn to 2.0, execute the site on browser, see the error (because the version is wrong) and turn back to 4.0 and "voilà", I got it, the website open.


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


In my case, I don't have access to the IIS itself and I was having this problem when I was using a single method which doesn't have anything special only things from .net 2.

The solution: I've Extracted that method and created a Class Library with .net 2.0 and it works.


Maybe it too late but I got the same problem and fixed as below. I use Visual Studio 2015 ,the configuration compilation on web.config point to .NET FrameWork 4.6 by default. I could not just edit only on the web.config file. If you can not install .NET FrameWork 4.6 on server and your application don't use it.

  1. Go to menu Debug > [Project Name] Properties > Application .
  2. choose the .NET Framework 4.5 (or any which server support and compatible your application) from Target Framwork dropdown list.
  3. Rebuild again.

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

참고URL : https://stackoverflow.com/questions/31253747/method-not-found-0-system-array-empty

반응형