2012-04-03 2 views
3

OpenPop.NET을 사용하여 Gmail 계정에 액세스하려고 시도하지만 기본 테스트 코드로도 아래 오류 메시지가 표시됩니다. 내가 .NET 프레임 워크 3.5 4. OpenPop DLL을 모두 그것을 참조하는 스크립트 작업과 함께 윈도우 7 시스템에서 SQL Server 비즈니스 인텔리전스 개발 Studio 2008의 SSIS 패키지에서이 작업을 수행하려고C# : 'OpenPop, Version = 2.0.4.369, Culture = neutral, PublicKeyToken = null'또는 해당 종속성 중 하나를로드 할 수 없습니다.

Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly 'OpenPop, Version=2.0.4.369, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. File name: 'OpenPop, Version=2.0.4.369, Culture=neutral, PublicKeyToken=null' at ST_1694f4bcdf2a4068ae871201a2216457.csproj.ScriptMain.Main()

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].

--- End of inner exception stack trace --- at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) at Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTATaskScriptingEngine.ExecuteScript()

3.5에 내장되고있다. 나는 이것을 며칠 동안 연구했지만 그것을 고칠 수있는 것을 찾을 수 없었다. 원본에서 OpenPop dll을 다시 컴파일하고 여러 번 참조를 제거하고 다시 추가하려고했습니다.

나는 현재 아래 게시 함께 일하고 코드 :

 Pop3Client client = new Pop3Client(); 

     try 
     { 
      client.Connect("pop.gmail.com", 995, true); 

      try 
      { 
       client.Authenticate("[email protected]", "mypassword"); 
       Console.WriteLine("Success"); 
       client.Disconnect(); 
      } 
      catch 
      { 
       Console.WriteLine("Failed to authenticate"); 
       Dts.TaskResult = (int)ScriptResults.Failure; 
       return; 
      } 
     } 
     catch 
     { 
      Console.WriteLine("Failed to connect"); 
      Dts.TaskResult = (int)ScriptResults.Failure; 
      return; 
     } 

     Dts.TaskResult = (int)ScriptResults.Success; 

미리 감사드립니다.

답변

7

필자도이 문제를 경험하고 해결책은 실제로 매우 간단합니다. 패키지를 실행중인 서버의 GAC에 참조 된 어셈블리를 설치해야합니다.

1) 어셈블리가 서명되었는지 확인하고, 자신의 어셈블리를 만든 경우 서명하십시오.

2) Visual Studio의 SDK 도구에서 gacutil.exe을 사용하여 DLL을 GAC에 설치합니다. 자세한 내용은 How to: Install an Assembly into the Global Assembly Cache을 참조하십시오.

3) 지금은 완벽하게 작동한다, 당신의 스크립트 작업

짜잔에서 같은 DLL을 참조!

+0

참고 : \ Gacutil.exe를 단지 개발을위한 프로덕션 어셈블리를 전역 어셈블리 캐시에 설치하는 데 사용해서는 안됩니다. – toha

1

1) 비주얼 스튜디오 명령 프롬프트 => Adminstrator으로 실행

2) gacutil/I "DLL 파일 경로"

3)를 참조

GAC (전역 어셈블리 캐시)에 DLL 설치 C에 조립 : \ WINDOWS \ system32를

또한 실종 DLL을 해결할 또는 SSIS 스크립트 작업에서 "파일 또는 어셈블리를로드 할 수 없습니다"는