code

파일, 어셈블리 또는 종속성 중 하나를로드 할 수 없습니다.

codestyles 2020. 10. 14. 07:50
반응형

파일, 어셈블리 또는 종속성 중 하나를로드 할 수 없습니다. 접근이 불가합니다. 문제는 무작위이지만 한 번 발생하면 계속됩니다.


이 오류에 대한 많은 정보를 찾았습니다. '오류 : 파일 또는 어셈블리'* .dll '또는 해당 종속성 중 하나를로드 할 수 없습니다. 접근이 불가합니다.' 하지만 내 시나리오에 특정한 답을 찾지 못했습니다. 내 사이트는 6 개의 서로 다른 프로덕션 서버에 배포되며 한 서버에만이 문제가 발생합니다. 문제는 무작위이지만 한 번 발생하면 web.config 파일에서 약간의 수정을 수행하여 사이트가 다시 컴파일 될 때까지 계속됩니다 (web.config에서 수정 한 후 웹 응용 프로그램을 다시 컴파일합니다) 및 해당 서버에서 사이트 시작 일. 어제 한 달간 작업 한 후 문제가 재현되었습니다. 우리는 생산에이 문제를 감당할 수 없습니다.
문제 세부 정보 :

'/'응용 프로그램에 서버 오류가 있습니다. ____________________________________ 파일 또는 어셈블리 'MainCore.DbImpl, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null'또는 해당 종속성 중 하나를로드 할 수 없습니다. 접근이 불가합니다. 설명 : 현재 웹 요청을 실행하는 동안 처리되지 않은 예외가 발생했습니다. 오류 및 코드에서 오류가 발생한 위치에 대한 자세한 정보는 스택 추적을 검토하십시오.

예외 정보 : System.IO.FileLoadException : 파일 또는 어셈블리 'MainCore.DbImpl, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null'또는 해당 종속성 중 하나를로드 할 수 없습니다. 접근이 불가합니다.

소스 오류 : 현재 웹 요청을 실행하는 동안 처리되지 않은 예외가 생성되었습니다. 아래의 예외 스택 추적을 사용하여 예외의 출처 및 위치에 대한 정보를 식별 할 수 있습니다.

어셈블리로드 추적 : 다음 정보는 'MainCore.DbImpl, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null'어셈블리를로드 할 수없는 이유를 확인하는 데 도움이 될 수 있습니다.

WRN : 어셈블리 바인딩 로깅이 꺼져 있습니다. 어셈블리 바인딩 실패 로깅을 사용하려면 레지스트리 값 [HKLM \ Software \ Microsoft \ Fusion! EnableLog] (DWORD)를 1로 설정하십시오. 참고 : 어셈블리 바인딩 실패 로깅과 관련된 성능 저하가 있습니다. 이 기능을 해제하려면 레지스트리 값 [HKLM \ Software \ Microsoft \ Fusion! EnableLog]를 제거하십시오.

스택 추적 :

[FileLoadException : 파일 또는 어셈블리 'MainCore.DbImpl, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null'또는 해당 종속성 중 하나를로드 할 수 없습니다. 액세스가 거부되었습니다.] ... root \ SportChannel의 ... DbImpl.Event.TTCEventController.GetEventFields (Int32 eventId) +0 WebSuite.SportChannel.ModelImpl.TTCModelController.AddEventFieldList (XmlElement eventNode, ITTCEventController ctrl, Int32 eventId, PlayerType stupidType) \ ModelImpl \ Ttc \ TTCModelController.cs : 171 ... root \ SportChannel \ ModelImpl \ Ttc \ TTCModelController.cs : 283의 ... ModelImpl.TTCModelController.GetLatestFourTourSchedulesXml () ... WebRoot.UserControls.HeadlinesTab.Page_Load (개체 발신자 , EventArgs e) +491 System.Web.Util.CalliHelper.EventArgFunctionCaller (IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.Util.CalliEventHandlerDelegateProxy.Callback (Object sender,
____________________________________

버전 정보 : Microsoft .NET Framework 버전 : 2.0.50727.5446; ASP.NET 버전 : 2.0.50727.5420


내 시나리오의 경우 web.config 파일에 ID 노드가 있음을 발견했습니다.

<identity impersonate="true" userName="blah" password="blah">

노드에서 userName 및 password 매개 변수를 제거하면 작동하기 시작했습니다.

또 다른 옵션은 지정된 userName이 다양한 C : \ Windows \ Microsoft.NET \ Framework {version} 폴더에있는 "임시 ASP.NET 파일"폴더에 대한 작업에 액세스 할 수 있는지 확인해야하는 것입니다.

이것이 다른 사람을 도울 수 있기를 바랍니다!


동일한 문제가 있었지만 "32 비트 응용 프로그램 사용" 매개 변수 "true"로 설정하여 수정했습니다 (iis 응용 프로그램 풀의 고급 설정에서).


내 솔루션은 다음과 같습니다.

에서 루트 폴더를 찾지 못했습니다 C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files.

Google은 현재 사용자에 대한 권한 문제 일 수 있다고 말한 다음 현재 ID가 있음을 발견 IIS APPPOOL했습니다. 서버의 나머지 부분에 현재 ID 가있는 오작동하는 서버에서 NT AUTHORITY\NETWORK SERVICE.

그런 다음 Current Identity를 IIS APPPOOL에서 NT AUTHORITY\NETWORK SERVICE.

여기에서 웹 앱을 재설정하면 임시 ASP.NET 캐시가 다시 작성되어 문제가 해결된다는 것을 알았습니다.


대부분의 솔루션을 시도했지만 여전히 문제가있는 다른 사람에게.

내 솔루션은이 게시물의 하단에있는 다른 솔루션과 다르지만 시도하기 전에 다음 목록을 모두 사용했는지 확인하십시오. 확실히, 나는 그들 모두를 시도했지만 아무 소용이 없습니다.

  1. 처음부터 다시 컴파일하고 재배포하고 기존 앱을 업데이트하지 마세요. 그래서 대답

  2. IIS_IUSRS에게 "C : \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET Files" 디렉터리에 대한 전체 액세스 권한을 부여합니다 .

    사용중인 프레임 워크 버전을 기억하십시오. 앱에서 가장을 사용하는 경우 IIS_IUSRS 대신 해당 ID를 사용하십시오.

  3. "C : \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Temporary ASP.NET Files" 디렉토리의 모든 내용을 삭제합니다 .

    사용중인 프레임 워크 버전을 염두에 두십시오.

  4. 앱에서 사용중인 AppPool의 ID를 ApplicatonPoolIdentity에서 NetworkService로 변경하십시오.

    IIS> 애플리케이션 풀> 현재 앱 풀 선택> 고급 설정> ID.

    그래서 대답 (작동하지 않으면 기본값으로 복원하십시오)

  5. 앱과 IIS 버전 및 AppPool .NET 버전 호환성을 확인하십시오. 최초 배포에 매우 적합합니다. 그래서 대답

  6. 해당되는 경우 가장 구성을 확인합니다. 그래서 대답

내 솔루션 :

특정 안티 바이러스 소프트웨어가 "Temporary ASP.NET Files" 디렉토리 내의 DLL 컴파일을 적극적으로 차단하고 있다는 사실을 알게되었습니다 . 제 것은 McAfee 였고 IT 담당자는 설치 사실을 알려주지 못했습니다.

McAfee 전문가와 Microsoft의 조언 에 따라 실시간 검색에서 "Temporary ASP.NET Files" 디렉터리를 제외해야합니다 .

출처 :

안티 바이러스는 그 기능을 수행하고 있기 때문에 비활성화하지 마십시오. \ Temporary ASP.NET Files {project name} 디렉토리에 누락 된 DLL 파일을 수동으로 복사하지 마십시오 . 이는 덕트 테이핑이기 때문입니다.


가장을 사용 하는 경우 다음 폴더의 관련 사용자 계정에 쓰기수정 권한을 포함한 권한을 부여해야 합니다.

C:\Users\[username]\AppData\Local\Temp\Temporary ASP.NET Files

수정 권한이 없어서 기본 권한을 추가하는 것만으로도 효과가 없었습니다.


여전히 문제가 발생하면 다음을 시도하십시오.

IIS 관리자 열기-> 응용 프로그램 풀-> 앱 풀 선택-> 고급 설정-> '프로세스 모델'에서 '사용자 프로필로드'설정을 True로 설정합니다.

여기에 이미지 설명 입력


I had the same issue, fixed by rebuild and redeploy ALL Dependents Dll files


I believe I wasted like 1 day on researching it and this what I have come out with.

You need to add the Impersonating user to the Debug folder of your Solution as the Framework will try to access the DLL from this location and place it in Temporary Asp.Net Folder.

So basically follow these 2 steps

  1. Give permission to Temporary Asp.Net Folder under C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files and make sure the user you are adding here is the same you are using while Impersonating.

  2. Add the Impersonating user to the Debug folder of your Solution YourSolutionPath .. \bin\Debug

This should work


In my case it was due to the Access Protection feature of my anti-virus (McAfee). It was obviously blocking access to this file, as of such the error.

I disabled it and the solution ran. You might want to check any utility application you might have running that could be affecting access to some files.


Go to IIS -> Application Pool -> Advance Settings -> Enable 32-bit Applications


Check the IIS settings. I use IIS 7.5 with 32 or 64 bit compilation within the .NET framework. If you have an app that uses 32-bit mode, make sure to enable the App Pool to be able to use 32-bit instruction. Otherwise, nothing seems to work no matter how much you set the security or strong sign the DLL.


I was not using impersonation in my case. My solution was to give full access to my project directory for the user group "IIS_IUSRS".


 Go to run  : ctrl + R
 Type : %temp%

delete All files & folders

 Rebuild Project.
 done!

I ran into this problem and it turned out that a referenced package/assembly was being encrypted by Windows. This happened because my company implemented a policy to require the My Documents folder to be encrypted and my Visual Studio solutions happened to be under that directory.

I could manually go into the file/directory properties in Windows Explorer and disable encryption. But in my case this was a temporary solution since the network policy would eventually change it back. I wound up moving my VS solution to another un-encrypted location.


In my case, I had copied a service from one server to another without performing a proper deployment from Visual Studio. Long story.

Anyway, I had setup all of the appropriate NTFS permissions and whatnot, but it still couldn't load the main DLL for the service.

I fixed it by renaming the corresponding service.pdb file to something else.

For example here's my bin folder: \bin\ service.dll service.dll.config service.pdb I renamed service.pdb to zzservice.pdb, and then the service.dll loaded fine.


I am setting-up environment on new server. My web.config got identity node like below.When I faced with "Could not load file or assembly or one of its dependencies. Access is denied. The issue is random, but after it happens once, it continues"

Added ccs\HJKWeb as users list of my new server.

  <authentication mode="Windows" />
        <identity impersonate="true" password="******" userName="ccs\HJKWeb" />

If you get the DLL could not be found instead of access denied, make sure you have the appropriate VC++ Redistributable installed.


I got this error running from VS. Turned out I'd opened a solution without running Visual Studio as admin. Closing Visual studio down and running it again as admin then rebuilding solved this for me.

Hope that helps someone.


In my case, I was using simple impersonation and the impersonation user had trouble accessing one of the project assemblies. My solution:

  1. Look for the message of the inner exception to identify the problematic assembly.
  2. Modify the security properties of the assembly file.

    a) Add the user account you're using for impersonation to the Group and user names.

    b) Give that user account full access to the assembly file.


For me, the following hack worked; Go to IIS -> Application Pools -> Advance Settings -> Process Model -> Identity Changed from Built-in Account (ApplicationPoolIdentity) to Custom Account (My Domain User)

참고URL : https://stackoverflow.com/questions/11096225/could-not-load-file-or-assembly-or-one-of-its-dependencies-access-is-denied-th

반응형