2016-06-28 3 views
0

내 WCF 응용 프로그램 내에서 OpenALPR을 실행하려고하는데 지금까지 실행할 수 없습니다. 계속 받고 있습니다WCF 응용 프로그램 내에서 OpenALPR을로드 할 수 없습니다.

"파일 또는 어셈블리 'openalpr-net.DLL'또는 해당 종속성 중 하나를로드 할 수 없습니다. 지정한 모듈을 찾을 수 없습니다."

VS2015-Community Edition뿐 아니라 IIS에서도 오류가 발생합니다.

다음 스레드를 추적했지만 내 문제를 해결할 수 없습니다. 모든 그것을 말한다 인터넷을 통해 https://groups.google.com/forum/#!topic/openalpr/Nu26YmbOSng

https://groups.google.com/forum/#!topic/openalpr/7ADDNSkhoLE

이 내가 현재로서는이 무엇인가, 플랫폼 문제입니다.

Visual Studio 2015 WCF Application 
Reference to openalpr-net.dll (64bit) in my project 
Copied opencv_world300.dll, opencv_ffmpeg300_64.dll, liblept170.dll into bin folder manually 
Included openalpr.conf in the root folder of WCF application 
Included runtime_data folder in the root folder of WCF application 
Set 'unblock' for all the dll's, and files under runtime_data folder 
Project > Properties > Build > General > Platform target > x64 
Project > Properties > Build > Configuration > Active(Debug) 
Project > Properties > Build > Platform > Active (x64) 

나는 또한 로컬 IIS 서버에 응용 프로그램을 게시, 내가 .NET 4.0 통합 모드로 응용 프로그램 풀을 설정, 내가 사용 및 사용 안 함 '32 비트 응용 프로그램을 사용'하려고했으나이 didn를 모두 ' 나를 위해 일한다.

내가 솔루션 탐색기에서 Service.svc을 선택하고 응용 프로그램을 디버깅

, 나는 내가 다운로드에 readme.txt 파일에서 다음 명령을 실행 할 수있는 WCF 테스트 클라이언트

Error: Cannot obtain Metadata from http://localhost:55460/AlprService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address. For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange Error URI: http://localhost:55460/AlprService.svc Metadata contains a reference that cannot be resolved: 'http://localhost:55460/AlprService.svc'. The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: ' 
Server Error in '/' Application. 
Could not load file or assembly 'openalpr-net.DLL' or one of its dependencies. The specified module could not be found. 
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 'openalpr-net.DLL' or one of its dependencies. The specified module could not be found. 

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. 

Stack Trace: 

[FileNotFoundException: Could not load file or assembly 'openalpr-net.DLL' or one of its dependencies. The specified module could not be found.] System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0 System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +234 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +108 System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +25 System.Reflection.Assembly.Load(String assemblyString) +34 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +49[ConfigurationErrorsException: Could not load file or assembly 'openalpr-net.DLL' or one of its dependencies. The specified module could not be found.] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +772 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +259 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +163 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +230 System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +76 System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +139 System.Web.Compilation.BuildManager.ExecutePreAppStart() +176 System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +882[HttpException (0x80004005): Could not load file or assembly 'openalpr-net.DLL' or one of its dependencies. The specified module could not be found.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +579 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +112 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +716 

에 오류가 아래 얻을 폴더에 아무런 문제없이 'alpr -p tx -n 30 samples/us-4.jpg'를 볼 수 있습니다.

또한 IIS에서 32 비트 응용 프로그램 사용을 설정하면 projectname을 말하면 오류가 발생합니다. dll이로드되지 않았습니다. 다른 'openalpr-net.DLL'이 누락되지 않습니다. Release-x64를 IIS에 게시하고 있습니다.

누구나 올바른 방향으로 제안하거나 알려줄 수 있습니까? 여기서 내가 뭘 잘못하고 있니?

답변

0

나는이 똑같은 질문에 머리를 쓰다듬어 버렸지 만 마침내 작동하게 만들었습니다.

64 비트 openalpr-net.dll에 대한 참조를 추가했는지 확인하십시오. 당신의 WCF 코드에서

어셈블리가

public string AssemblyDirectory 
    { 
     get 
     { 
      var codeBase = Assembly.GetExecutingAssembly().CodeBase; 
      var uri = new UriBuilder(codeBase); 
      var path = Uri.UnescapeDataString(uri.Path); 
      return Path.GetDirectoryName(path); 
     } 
    } 
     String config_file = Path.Combine(AssemblyDirectory, "openalpr.conf"); 
     String runtime_data_dir = Path.Combine(AssemblyDirectory, "runtime_data"); 

     using (var alpr = new AlprNet("us", config_file, runtime_data_dir)) 

가 로컬 또는 원격 IIS로 WCF 게시이 코드를 사용하여 어디 동일한 폴더에서 conf의 파일 및 runtime_data 폴더를로드해야합니다. c : \ inetpub \ wwwroot \ alprService에 게시한다고 가정 해보십시오. openalpr.conf 파일과 runtime_data 폴더를 c : \ inetpub \ wwwroot \ alprService \ bin \ 폴더에 복사하십시오. 3 dll, liblept170.dll, opencv_ffmpeg300_64.dll 및 opencv_world300.dll을 호스팅 서버의 system32 폴더에 복사합니다. 이러한 dll은 github의 openalpr-net.dll과 같은 폴더에서 찾을 수 있습니다.

이 방법이 유용했는지 알려주세요. 나는 이미지를 보내고 성냥의 명부를 돌려받을 수있다.

이제 오류없이 wcf 서비스를로드 할 수 있어야합니다.