IT story

파일 또는 어셈블리를로드 할 수 없습니다… 매개 변수가 잘못되었습니다

hot-time 2020. 4. 30. 07:35
반응형

파일 또는 어셈블리를로드 할 수 없습니다… 매개 변수가 잘못되었습니다


최근에 C # 솔루션에서 다음 예외를 만났습니다.

오류 2 파일 또는 어셈블리 'Newtonsoft.Json, 버전 = 3.5.0.0, Culture = neutral, PublicKeyToken = b9a188c8922137c6'또는 해당 종속성 중 하나를로드 할 수 없습니다. 파라미터가 잘못되었습니다. (HRESULT 예외 : 0x80070057 (E_INVALIDARG))

이것은 내 코드 또는 어셈블리 이름 ( Newtonsoft.Json이 경우 와 같이) 의존하지 않습니다 .

솔루션 에서이 dll을 삭제하면 컴파일러는 동일한 예외에서 다른 것에 대해 알려줍니다. 그래서 내 PC에서 무언가가 꺼져 있거나 켜져 있다고 가정합니다. :)


손상된 어셈블리가 참조되는 것 같습니다.

둘 다 지우십시오.

  1. 프로젝트의 \ bin 폴더

  2. 임시 폴더 ( C:\Users\your_username\AppData\Local\Temp\Temporary ASP.NET FilesWindows 7에 있어야 함 )

오류가 계속 발생하는지 확인하십시오.


X64를 실행 중인지에 따라 몇 개의 스팟을 더 정리해야 할 수도 있습니다. 내 사용자 디렉토리를 정리하는 것만으로는 충분하지 않습니다.

  1. % TEMP % \ 임시 ASP.NET 파일
  2. C : \ Windows \ Microsoft.NET \ Framework \ v2.0.50727 \ 임시 ASP.NET 파일
  3. C : \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ 임시 ASP.NET 파일
  4. C : \ Windows \ Microsoft.NET \ Framework64 \ v2.0.50727 \ 임시 ASP.NET 파일
  5. C : \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ 임시 ASP.NET 파일

이 목록은 다른 버전의 프레임 워크가 설치된 것처럼 커집니다.


나는 지워야했다

C : /Windows/Microsoft.NET/Framework/v4.0.30319/ 임시 ASP.NET 파일

그래야만 문제가 해결되었습니다.


무엇을 지우는 지 확인하려면 다음 레지스트리 키를 추가하십시오.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion\EnableLog (DWord set to 1).

그러면 아래와 같은 출력이 나타납니다. 이것은 asp.net이 DLL을로드하려는 위치를 알려줍니다. 이 디렉토리를 지우십시오.

LOG: This bind starts in default load context.
LOG: Using application configuration file: c:\app\AtlasAdvisor\web\web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\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/Framework/v4.0.30319/Temporary ASP.NET Files/root/3c8629f7/dfa387b6/Avanade.ViddlerNet.DLL.**
LOG: Attempting download of new URL **file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/3c8629f7/dfa387b6/Avanade.ViddlerNet/Avanade.ViddlerNet.DLL**.

프로젝트의 임시 프레임 워크 파일을 다음에서 지우십시오.

C : \ WINDOWS \ Microsoft.NET \ Framework \ v2.0.50727 \ 임시 ASP.NET 파일 \


또한 패키지 디렉토리를 지우고 NuGet 이 누락 된 패키지를 다시 다운로드 하도록 허용 할 수 있습니다

그것은 나를 위해 문제를 해결했다


이 폴더에서 모든 파일을 삭제하십시오.

C : /Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET 파일 C : /Windows/Microsoft.NET/Framework64/v4.0.30319/Temporary ASP.NET 파일


소스 제어에서 새로운 바이너리 세트를 얻는 것이 도움이되었습니다.

감사


이 폴더를 지우십시오. (Windows x64 만 해당)

C : \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ 임시 ASP.NET 파일


감사합니다. Alex가 두 번째 요점으로이 문제를 해결하도록 도와주었습니다.

It appears that unless you run visual studio as an administrator in Windows 7 it stores your temp files locally rather than C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files.

See following blog post: http://www.dotnetscraps.com/dotnetscraps/post/Location-of-Temporary-ASPNET-files-in-Vista-or-Windows-7.aspx


I had the same issue here - above solutions didn't work. Problem was with ActionMailer. I ran the following uninstall and install nuget commands

uninstall-package ActionMailer
install-package ActionMailer

Resolved my problems, hopefully will help someone else.


This can happen while referencing COM wrapper dlls. Within your Visual Studio Project, under References, select the COM wrapper dlls being referenced and ensure they have the the following property values: "Embed Interop Types": False and "Specific Version": False.


I just delete my application temp data from this path

C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files

Problem resolve


I see lot of techies have posted about clearing temporary directories of ASP .Net run-time pertaining to each and every .Net framework hosted on your machine as in this answer. But I believe we should know the clear-cut logistics as to why we need to blindly clear all of temporary working directories of all .Net frameworks. According to me, it should not be the case.

My advice would be that you should try a pin pointed directory clearing approach to resolve this issue. How would you know which directory to clear?

  1. Go to IIS and right click on your website node in left navigation pane to open the context menu. In the context menu point to Manage Application -> Advanced Settings... to open the Advanced Settings window.
  2. Check the Application Pool your website is assigned to. In my case it is DefaultAppPool as shown below:

enter image description here

  1. Now go to Application Pools node in left navigation bar in the IIS. Now check that which .Net CLR Version is being run by your app pool. In my case it is v4.0 as shown below:

enter image description here

Since the CLR version being hosted by my app pool is v4.0, so I prcisely cleared only the temporary files in the folder pertaining to ASP .NET v4.0 only as below:

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files

And that's it. My problem got resolved.

Lesson learnt: This is indicative of the fact that all the temporary files being used by your website aren't scattered across several directories but they are at once place being referred by your app pool. So you need to clear that specific folder only.


Clearing C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files worked for me. Thinking of automating the deletion process to avoid the issue in future.


If you are using SQL Server 2012's Data Tools, which uses the VS2010 shell as at May 1 2013, check your Configuration Manager settings. A server name change from Workflow to xCPWorkflow was enough to produce the exact same The parameter is incorrect (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) message.


You can either clean, build or rebuild your application or simply delete Temporary ASP.NET Files at C:\Users\YOUR USERNAME\AppData\Local\Temp

This works like magic. In my case i had an assembly binding issue saying Could not load file bla bla bla

you can also see solution 2 as http://www.codeproject.com/Articles/663453/Understanding-Clean-Build-and-Rebuild-in-Visual-St


I had this problem when making controller in MVC. I changed version .net framework. The problem was solved


The problem relates to the .Net runtime version of a referenced class library (expaned references, select the library and check the "Runtime Version". I had a problem with Antlr3.Runtime, after upgrading my visual studio project to v4.5. I used NuGet to uninstall Microsoft ASP.NET Web Optimisation Framework (due to a chain of dependencies that prevented me from uninstalling Antlr3 directly)

I then used NuGet to reinstall the Microsoft ASP.NET Web Optimisation Framework. This reinstalled the correct runtime versions.


In my case i wanted to compile a COM visible DLL. The problem was that an older version of this DLL was located here:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE

Thus Visual Studio loaded this version instead of the newly compiled one, as it tried to register it.


Clear all files from temporary folder (C:\Users\user_name\AppData\Local\Temp\Temporary ASP.NET Files\project folder)


Sometimes you, also, need to clean this folder: C:\Windows\Temp\Temporary ASP.NET


I faced same error because application didn't find dependent frameworks in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\ folder. I just repair my Visual studio which added required framework in above location and it working fine.


In my case, changing the IISExpress port number in my project properties, solved the problem.


If anyone else out there is using the WiX toolset, I discovered that my installer project had a reference to an old project that had recently been removed from the solution. Took me a while to realize since there are a number of projects in the solution I was attempting to build and the message did not indicate which project was failing to build (and clean, which was failing as well).


I had users of Siemens Teamcenter 10 Client for Microsoft Office getting the same error about a different DLL. None of the other answers worked. The solution was to delete the folders in

C:\Users\%username%\AppData\Local\assembly\

참고URL : https://stackoverflow.com/questions/8269386/could-not-load-file-or-assembly-the-parameter-is-incorrect

반응형