2012-07-16 3 views
0

Newtonsoft.JSON 라이브러리를 사용하는 .NET 2.0 C# 프로젝트에서 작업하고 있습니다. web.config 파일을 확인하면 모든 어셈블리가 2.0 버전을 참조합니다..NET 3.5 예기치 않은 오류가 발생하여 포함했습니다.

그러나 나는 다음과 같은 오류 얻을 서버에 배포 할 때 :

Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. 
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.IO.FileNotFoundException: Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified. 

Source Error: 


Line 21:  } 
Line 22: 
Line 23:  Dictionary<string, string> config = JavaScriptConvert.DeserializeObject<Dictionary<string, string>>(jason); 
Line 24: 
Line 25:  if (Request.Form["login"] == config["adminLogin"] && FormsAuthentication.HashPasswordForStoringInConfigFile(Request.Form["password"], "sha1") == config["adminPass"]) 


Source File: c:\Website\WSRecrut\Test\ConnectionPost.aspx Line: 23 

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' could not be loaded. 


WRN: Assembly binding logging is turned OFF. 
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. 
Note: There is some performance penalty associated with assembly bind failure logging. 
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog]. 


Stack Trace: 


[FileNotFoundException: Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The system cannot find the file specified.] 
    Newtonsoft.Json.Utilities.CollectionUtils.CreateDictionaryWrapper(Object dictionary) in D:\Newtonsoft\Projects\Json\trunk\Src\Newtonsoft.Json\Utilities\CollectionUtils.cs:422 
    Newtonsoft.Json.JsonSerializer.CreateObject(JsonReader reader, Type objectType, Object existingValue) in D:\Newtonsoft\Projects\Json\trunk\Src\Newtonsoft.Json\JsonSerializer.cs:223 
    Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) in D:\Newtonsoft\Projects\Json\trunk\Src\Newtonsoft.Json\JsonSerializer.cs:169 
    Newtonsoft.Json.JavaScriptConvert.DeserializeObject(String value, Type type, JsonConverter[] converters) in D:\Newtonsoft\Projects\Json\trunk\Src\Newtonsoft.Json\JavaScriptConvert.cs:512 
    Newtonsoft.Json.JavaScriptConvert.DeserializeObject(String value, JsonConverter[] converters) in D:\Newtonsoft\Projects\Json\trunk\Src\Newtonsoft.Json\JavaScriptConvert.cs:485 
    Newtonsoft.Json.JavaScriptConvert.DeserializeObject(String value) in D:\Newtonsoft\Projects\Json\trunk\Src\Newtonsoft.Json\JavaScriptConvert.cs:457 
    ASP.connectionpost_aspx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Website\WSRecrut\Test\ConnectionPost.aspx:23 
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +2113547 
    System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +24 
    System.Web.UI.Page.Render(HtmlTextWriter writer) +26 
    System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +25 
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +121 
    System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +22 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1896 

아무도 생각이 있습니까를? 3.5에서의 그 어셈블리는 어디서 올 수 있습니까?

답변

1

NewtonSoft.Json.dll 라이브러리를 잘못 포함했다고 판단됩니다. 여러 어셈블리가 있으며 그 중 하나만 .NET 2.0을 지원합니다.

Reflector/JustDecompile이있는 경우 내부 클래스가 Newtonsoft.Json.Utilities.LinqBridge 인 것을 확인할 수 있습니다. 그게 System.Core LINQ 메서드를 사용하지 않고 빠져 나갈 수있게 해줍니다.

파일 세부 정보에도 .NET 2.0이 있습니다.

+0

마크, 오른쪽 .NET 2.0 Newtonsoft 라이브러리를 사용하고 있습니다. Visual Studio 2008로 컴파일하면 .NET 2.0을 대상으로 오류가 표시되지 않습니다. –

+0

사실 Newtonsoft 라이브러리는 오래되었습니다. 2.0 버전으로 업그레이드했을 때 모두 정상적으로 작동했습니다. 감사. –

1

이 데이터를 가져 오는 또 다른 경로는 예외의 세부 사항을 보는 것입니다 ... 디버거가 실행 중인지 확인하고 세부 사항을 보려면 예외를 중지해야합니다.

이 모든 구성 문제 (세부 사항에 대한 모든 것 - "aspnet_regiis -lk"의 출력과 같은 모든 것을 확인할 수 있음)이거나 .NET 설치가 손상된 것 같습니다 훨씬 덜 가능성). 그렇지

,

은 " 'System.Web.Extensions는"GAC에 설치해야 강력한 이름의 어셈블리 인 파일 찾을 수 없음 문제는 서브 디렉토리의 상대 경로 문제로 인해 발생해서는 안

. 제 생각에는 문제는 AJAX 1.0 확장이 서버에 설치되어 있지 않다는 것입니다.

이 문제를 해결하기 위해 "어셈블리"섹션에서 "System.Web.Extensions"어셈블리 "1.0.61025.0"버전을 제거 할 수 있습니다. 앞에서 말한 것처럼 LINQ 어셈블리를 찾을 수 없다는 문제가 발생했습니다. 이 문제에 대해서는 .NET Framework 3.5가 서버에 설치되어 있는지 확인하는 것이 좋습니다.

+0

나는 Ajax를 사용하지 않지만 어쨌든 고마워. 테스트 할 모든 어셈블리를 제거합니다. –

+2

항상 환영합니다 ... – Abhijeetchindhe

2

1, 파서 오류 메시지 : 'System.Core, Version = 3.5.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089'또는 해당 종속성 중 하나를로드 할 수 없습니다. 시스템이 지정된 파일을 찾을 수 없습니다.

목표 컴퓨터에 .NET Framework 3.5가 설치되어 있는지 여부에 관계없이 투자하는 것이 좋습니다. 확인 도구를 다운로드하여 목표 컴퓨터에서 .NET Framework 상태를 확인할 수 있습니다. 다음 링크를 클릭하십시오.

http://blogs.msdn.com/b/astebner/archive/2008/10/13/8999004.aspx

2

는 WRN : 어셈블리 바인딩 로깅 오프된다.

는 어셈블리 바인딩 오류 로깅을 활성화 1.

참고 레지스트리 값 [HKLM \ 소프트웨어 \ 마이크로 소프트 \ 퓨전 EnableLog!] (DWORD)를 설정하려면 : 어셈블리 바인딩 오류 로깅과 관련된 약간의 성능 저하가 있습니다.

당신은 오류 정보에 기초하여 레지스트리를 수정할 수 있습니다,이 기능을 해제 작동하지 않는 경우 레지스트리 값을

를 제거하십시오.

다음 단계를 하나씩 수행 할 수 있습니다.

1, 개방 '실행'

2 유형 'regedit를'

3, 백업 레지스트리

4, 레지스트리

5의 키를 검색에 그 값을 수정 오류 정보의 기초

+0

감사합니다. .NET 3.5가 대상 서버에 설치되어 있지 않습니다. 그래서 .NET 2.0 프로젝트를 썼습니다. –

관련 문제