2011-11-07 1 views
8

배포 할 때이 문제가 발생합니다. 실제로 해결 방법을 모르겠습니다. 어떤 생각?파일 또는 어셈블리 'AutoMapper'또는 해당 종속성 중 하나를로드 할 수 없습니다.

Server Error in '/' Application. 
Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 

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.BadImageFormatException: Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. 

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. 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'AutoMapper' could not be loaded. 


=== Pre-bind state information === 
LOG: User = IIS APPPOOL\DefaultAppPool 
LOG: DisplayName = AutoMapper 
(Partial) 
LOG: Appbase = file:///C:/inetpub/wwwroot/ 
LOG: Initial PrivatePath = C:\inetpub\wwwroot\bin 
Calling assembly : (Unknown). 
=== 
LOG: This bind starts in default load context. 
LOG: Using application configuration file: C:\inetpub\wwwroot\web.config 
LOG: Using host configuration file:C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Aspnet.config 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v2.0.50727\config\machine.config. 
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/root/e22c2559/92c7e946/AutoMapper.DLL. 
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/Temporary ASP.NET Files/root/e22c2559/92c7e946/AutoMapper/AutoMapper.DLL. 
LOG: Attempting download of new URL file:///C:/inetpub/wwwroot/bin/AutoMapper.DLL. 
ERR: Failed to complete setup of assembly (hr = 0x8013101b). Probing terminated. 

Stack Trace: 


[BadImageFormatException: Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.] 
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +416 
    System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +166 
    System.Reflection.Assembly.Load(String assemblyString) +35 
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +190 

[ConfigurationErrorsException: Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.] 
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11224200 
    System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +388 
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +232 
System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +48 
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +210 
System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath configPath, Boolean supportLocalization, String outputAssemblyName) +76 
System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean isPrecompiledApp) +283 

System.Web.Compilation.BuildManager.CompileGlobalAsax() +50 System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() 676

[HttpException (0x80004005): Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.] 
    System.Web.Compilation.BuildManager.ReportTopLevelCompilationException() +76 
    System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled() +1012 
    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager,  IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters) +1025 

[HttpException (0x80004005): Could not load file or assembly 'AutoMapper' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.] 
    System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11318198 
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +88 
    System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4348404 

버전 정보 : 마이크로 소프트 .NET 프레임 워크 버전 : 2.0.50727.5446; ASP.NET 버전 : 2.0.50727.5420

답변

11

응용 프로그램 풀은 .NET 2.0 구성 :

버전 정보 : 마이크로 소프트 .NET 프레임 워크 버전 : 2.0.50727.5446을; ASP.NET 버전 : 현재로드 런타임보다 최신 런타임에 의해

"이 어셈블리를 빌드 할 수 없습니다 : 2.0.50727.5420

전개 된 AutoMapper 어셈블리는 .NET 4.0 구축 짐을 실은."

이것은 함께 작동하지 않습니다. 아마 .NET 4.0으로 응용 프로그램 풀을 전환하여이 문제를 해결할 수 있습니다.

+0

내가 C : \ inetpub \ wwwroot \ bin에 갈 때 어셈블리가 있습니다. – elranu

+0

답변을 업데이트했습니다. 어셈블리가 있지만 이전 런타임에로드 할 수 없습니다. – driis

+0

고마워요! 내 apppool을 설치하는 것을 잊었을 까? – elranu

2

AppPool 변경 시도 ... IIS에서 응용 프로그램을 마우스 오른쪽 버튼으로 클릭하고 응용 프로그램 관리 => 고급 설정 => 풀 변경을 클릭하십시오. asp.net v4 pool이 나를 위해 일했습니다 ...

0

AutoMapper DLL에 대한 참조를 확인하십시오. 잘못된 것일 수 있습니다. 그것을 제거하고 다시 추가해야 할 수도 있습니다.