Microsoft MVP성태의 닷넷 이야기
오류 유형: 456. 닷넷 응용 프로그램 실행 시 0x80131401 예외 발생 [링크 복사], [링크+제목 복사]
조회: 9751
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 

닷넷 응용 프로그램 실행 시 0x80131401 예외 발생

다음과 같은 예외가 발생한다면?

Server Error in '/' Application.
--------------------------------------------------------------------------------

Configuration Error 
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. 

Parser Error Message: An error occurred creating the configuration section handler for system.codedom: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)

Source Error: 


An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
 

Source File: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\web.config    Line: 50 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1031 

아쉬운 것은, 어떤 DLL을 로드하다가 실패했는지 알 수 없다는 점입니다. 심지어 이벤트 로그를 살펴봐도,

Event code: 3008 
Event message: A configuration error has occurred. 
Event time: 2018-03-16 오전 9:07:16 
Event time (UTC): 2018-03-16 오전 12:07:16 
Event ID: a144b120efee431783f32b3fb1ffe2f4 
Event sequence: 1 
Event occurrence: 1 
Event detail code: 0 
 
Application information: 
    Application domain: /LM/W3SVC/1053363633/Root-39211-131656324365434624 
    Trust level: Full 
    Application Virtual Path: / 
    Application Path: D:\TestWebSiteV4\ 
    Machine name: win2003test
 
Process information: 
    Process ID: 2616 
    Process name: w3wp.exe 
    Account name: NT AUTHORITY\SYSTEM 
 
Exception information: 
    Exception type: ConfigurationErrorsException 
    Exception message: An error occurred creating the configuration section handler for system.codedom: Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401) (C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\web.config line 50)
   at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
   at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
   at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
   at System.Web.Configuration.HttpConfigurationSystem.GetApplicationSection(String sectionName)
   at System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)
   at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)
   at System.Configuration.ConfigurationManager.GetSection(String sectionName)
   at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
   at System.CodeDom.Compiler.CodeDomProvider.get_Config()
   at System.CodeDom.Compiler.CodeDomProvider.GetCompilerInfoForExtensionNoThrow(String extension)
   at System.CodeDom.Compiler.CodeDomProvider.IsDefinedExtension(String extension)
   at System.Web.Compilation.CompilationUtil.GetProviderOptions(Type codeDomProviderType)
   at System.Web.Compilation.CompilationUtil.GetProviderOption(Type codeDomProviderType, String providerOption)
   at System.Web.Compilation.CompilationUtil.GetCompilerVersion(Type codeDomProviderType)
   at System.Web.Compilation.MultiTargetingUtil.GetCSharpCompilerVersion()
   at System.Web.Compilation.MultiTargetingUtil.ValidateCompilerVersionFor40AndAbove()
   at System.Web.Compilation.MultiTargetingUtil.InitializeTargetFrameworkNameFor40AndAbove(String targetFrameworkMoniker)
   at System.Web.Compilation.MultiTargetingUtil.InitializeTargetFrameworkName()
   at System.Web.Compilation.MultiTargetingUtil.EnsureFrameworkNamesInitialized()
   at System.Web.Compilation.BuildManager.Initialize()
   at System.Web.Compilation.BuildManager.InitializeBuildManager()
   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)

Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)
   at System.Xml.XmlDocument.Load(XmlReader reader)
   at System.Configuration.ErrorInfoXmlDocument.LoadFromConfigXmlReader(ConfigXmlReader reader)
   at System.Configuration.ErrorInfoXmlDocument.CreateSectionXmlNode(ConfigXmlReader reader)
   at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
   at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithFullTrust(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
   at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSection(Boolean inputIsTrusted, RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
   at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)
   at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)

 
 
Request information: 
    Request URL: http://localhost:8010/about.aspx 
    Request path: /about.aspx 
    User host address: 127.0.0.1 
    User:  
    Is authenticated: False 
    Authentication Type:  
    Thread account name: NT AUTHORITY\SYSTEM 
 
Thread information: 
    Thread ID: 37 
    Thread account name: NT AUTHORITY\SYSTEM 
    Is impersonating: False 
    Stack trace:    at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
   at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
   at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission)
   at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
   at System.Web.Configuration.HttpConfigurationSystem.GetApplicationSection(String sectionName)
   at System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)
   at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)
   at System.Configuration.ConfigurationManager.GetSection(String sectionName)
   at System.Configuration.PrivilegedConfigurationManager.GetSection(String sectionName)
   at System.CodeDom.Compiler.CodeDomProvider.get_Config()
   at System.CodeDom.Compiler.CodeDomProvider.GetCompilerInfoForExtensionNoThrow(String extension)
   at System.CodeDom.Compiler.CodeDomProvider.IsDefinedExtension(String extension)
   at System.Web.Compilation.CompilationUtil.GetProviderOptions(Type codeDomProviderType)
   at System.Web.Compilation.CompilationUtil.GetProviderOption(Type codeDomProviderType, String providerOption)
   at System.Web.Compilation.CompilationUtil.GetCompilerVersion(Type codeDomProviderType)
   at System.Web.Compilation.MultiTargetingUtil.GetCSharpCompilerVersion()
   at System.Web.Compilation.MultiTargetingUtil.ValidateCompilerVersionFor40AndAbove()
   at System.Web.Compilation.MultiTargetingUtil.InitializeTargetFrameworkNameFor40AndAbove(String targetFrameworkMoniker)
   at System.Web.Compilation.MultiTargetingUtil.InitializeTargetFrameworkName()
   at System.Web.Compilation.MultiTargetingUtil.EnsureFrameworkNamesInitialized()
   at System.Web.Compilation.BuildManager.Initialize()
   at System.Web.Compilation.BuildManager.InitializeBuildManager()
   at System.Web.HttpRuntime.HostingInit(HostingEnvironmentFlags hostingFlags, PolicyLevel policyLevel, Exception appDomainCreationException)

역시 정보가 없습니다. 메시지에서 의미하는 50 번째 라인은 "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\web.config" 파일에서 다음과 같이 codedom 설정이 시작되는 구간입니다.

<system.codedom>
    <compilers>
        <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <providerOption name="CompilerVersion" value="v4.0"/>
            <providerOption name="WarnAsError" value="false"/>
        </compiler>
        <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
            <providerOption name="CompilerVersion" value="v4.0"/>
            <providerOption name="OptionInfer" value="true"/>
            <providerOption name="WarnAsError" value="false"/>
        </compiler>
    </compilers>
</system.codedom>

이벤트 로그에는 나오지 않지만 "Loading this assembly would produce a different grant set from other instances" 메시지는 System.IO.FileLoadException 예외가 발생했을 때 볼 수 있는 것입니다.




위의 오류가 발생한 이유는 응용 프로그램의 이력을 살펴보는 것으로 해결할 수 있었습니다. 배경을 설명해 보면, .NET 4.5부터 추가된 System.Net.Http.dll 어셈블리를 참조해 Windows Server 2003에 배포한 것입니다. 즉, System.Net.Http.dll 파일을 로드할 수 없어 저런 예외가 발생한 것입니다. (.NET 4.5는 Windows Server 2003을 지원하지 않아 문제가 발생한 환경에서는 System.Net.Http.dll이 없었던 것입니다.)

혹시나 0x80131401 예외가 발생한다면? 해당 머신에 설치되지 않은 구성 요소가 있는지? 또는 새롭게 배포한 프로젝트에 신규로 추가한 참조 어셈블리가 있는지 확인해 보시면 됩니다.





[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]







[최초 등록일: ]
[최종 수정일: 3/20/2018]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




... 31  32  33  34  35  36  37  38  39  40  41  42  43  44  [45]  ...
NoWriterDateCnt.TitleFile(s)
12495정성태1/19/202111045웹: 40. IIS의 HTTP/2 지원 여부 - h2, h2c [1]
12494정성태1/19/202110205개발 환경 구성: 522. WSL2 인스턴스와 호스트 측의 Hyper-V에 운영 중인 VM과 네트워크 연결을 하는 방법 [2]
12493정성태1/18/20218602.NET Framework: 1009. .NET 5에서의 네트워크 라이브러리 개선 (1) - HTTP 관련 [1]파일 다운로드1
12492정성태1/17/20217992오류 유형: 695. ASP.NET 0x80131620 Failed to bind to address
12491정성태1/16/20219576.NET Framework: 1008. 배열을 반환하는 C# COM 개체의 메서드를 C++에서 사용 시 메모리 누수 현상 [1]파일 다운로드1
12490정성태1/15/20219156.NET Framework: 1007. C# - foreach에서 열거 변수의 타입을 var로 쓰면 object로 추론하는 문제 [1]파일 다운로드1
12489정성태1/13/202110140.NET Framework: 1006. C# - DB에 저장한 텍스트의 (이모티콘을 비롯해) 유니코드 문자가 '?'로 보인다면? [1]
12488정성태1/13/202110366.NET Framework: 1005. C# - string 타입은 shallow copy일까요? deep copy일까요? [2]파일 다운로드1
12487정성태1/13/20218894.NET Framework: 1004. C# - GC Heap에 위치한 참조 개체의 주소를 알아내는 방법파일 다운로드1
12486정성태1/12/20219816.NET Framework: 1003. x64 환경에서 참조형의 기본 메모리 소비는 얼마나 될까요? [1]
12485정성태1/11/202110531Graphics: 38. C# - OpenCvSharp.VideoWriter에 BMP 파일을 1초씩 출력하는 예제파일 다운로드1
12484정성태1/9/202111182.NET Framework: 1002. C# - ReadOnlySequence<T> 소개파일 다운로드1
12483정성태1/8/20218395개발 환경 구성: 521. dotPeek - 훌륭한 역어셈블 소스 코드 생성 도구
12482정성태1/8/20219805.NET Framework: 1001. C# - 제네릭 타입/메서드에서 사용 시 경우에 따라 CS8377 컴파일 에러
12481정성태1/7/20219544.NET Framework: 1000. C# - CS8344 컴파일 에러: ref struct 타입의 사용 제한 메서드파일 다운로드1
12480정성태1/6/202112123.NET Framework: 999. C# - ArrayPool<T>와 MemoryPool<T> 소개파일 다운로드1
12479정성태1/6/20219490.NET Framework: 998. C# - OWIN 예제 프로젝트 만들기
12478정성태1/5/202111114.NET Framework: 997. C# - ArrayPool<T> 소개파일 다운로드1
12477정성태1/5/202113515기타: 79. github 코드 검색 방법 [1]
12476정성태1/5/202110170.NET Framework: 996. C# - 닷넷 코어에서 다른 스레드의 callstack을 구하는 방법파일 다운로드1
12475정성태1/5/202112754.NET Framework: 995. C# - Span<T>와 Memory<T> [1]파일 다운로드1
12474정성태1/4/202110305.NET Framework: 994. C# - (.NET Core 2.2부터 가능한) 프로세스 내부에서 CLR ETW 이벤트 수신 [1]파일 다운로드1
12473정성태1/4/20219101.NET Framework: 993. .NET 런타임에 따라 달라지는 정적 필드의 초기화 유무 [1]파일 다운로드1
12472정성태1/3/20219390디버깅 기술: 178. windbg - 디버그 시작 시 스크립트 실행
12471정성태1/1/20219856.NET Framework: 992. C# - .NET Core 3.0 이상부터 제공하는 runtimeOptions의 rollForward 옵션 [1]
12470정성태12/30/202010048.NET Framework: 991. .NET 5 응용 프로그램에서 WinRT API 호출 [1]파일 다운로드1
... 31  32  33  34  35  36  37  38  39  40  41  42  43  44  [45]  ...