2016-06-28 7 views
0

OpenALPRをWCFアプリケーション内で実行しようとしていますが、実行できません。私は続けるWCFアプリケーション内でOpenALPRを読み込めません

"ファイルまたはアセンブリ 'openalpr-net.DLL'またはその依存関係の1つを読み込めませんでした。指定されたモジュールが見つかりませんでした。

VS2015-CommunityエディションとIISの両方でエラーが発生しました。

私は以下のスレッドに従っていますが、私の問題を解決できませんでした。すべてのインターネット上で

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

これは私が今のよう持っているもので、それはプラットフォームの問題であると言います。

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の両方私のために働く。 WCFテストクライアントで

私はソリューションエクスプローラでService.svcを選択して、アプリをデバッグ、私はエラーの下に取得

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 

私はダウンロードにreadme.txtファイルから次のコマンドを実行することができますまた、IIS上で32ビットアプリケーションを有効にすると、projectnameというエラーが表示されます。この問題を解決するには、次の手順を実行します。 dllがロードされていない、それ以外の場合は 'openalpr-net.DLL'が失われていません。私はIISにRelease - x64を公開しています。

誰かが正しい方向に私を示唆したり指したりすることはできますか?私はここで間違って何をしていますか?

答えて

0

私はこのまったく同じ質問で頭を傷つけていましたが、ついにそれが機能しました。

64ビットのopenalpr-net.dllへの参照を必ず追加してください。あなたのWCFのコードで

あなたはアセンブリがローカルまたはリモートのIISへのあなたの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)) 

を使用している同じフォルダから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サービスをロードできるようになりました。

関連する問題