我々は3つのプロジェクトがあります。ファイルまたはアセンブリをロードできませんでした「DocumentDB.Spatial.Sql.dll」またはその依存関係の1つ
- クラスライブラリ(ターゲットフレームワーク4.5)
- Webアプリケーション(MVC)プロジェクト(ターゲットフレームワーク4.5)
- ウェブAPIプロジェクト(ターゲットフレームワーク4.5.2)
は最近AzureのコスモスDB(文書DBドライバ)で働き始めました。すべての実装は、API & Web Appプロジェクトで使用されるクラスライブラリで行われます。
どうやら、Webアプリケーションが正常に動作しますが、REST APIプロジェクトがエラーをスローします。
今Could not load file or assembly 'file:///API\bin\DocumentDB.Spatial.Sql.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
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.BadImageFormatException: Could not load file or assembly 'file:///D:\API\bin\DocumentDB.Spatial.Sql.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
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.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'file:///D:\API\bin\DocumentDB.Spatial.Sql.dll' 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:
[BadImageFormatException: Could not load file or assembly 'file:///D:\API\bin\DocumentDB.Spatial.Sql.dll' or one of its dependencies. The module was expected to contain an assembly manifest.]
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.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +36
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +102
System.Reflection.Assembly.LoadFrom(String assemblyFile) +34
WebActivator.PreApplicationStartCode.Start() in D:\Code\Bitbucket\WebActivator\WebActivator\PreApplicationStartCode.cs:11
[InvalidOperationException: The pre-application start initialization method Start on type WebActivator.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'file:///D:\API\bin\DocumentDB.Spatial.Sql.dll' or one of its dependencies. The module was expected to contain an assembly manifest..]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +613
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +141
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +102
System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531
[HttpException (0x80004005): The pre-application start initialization method Start on type WebActivator.PreApplicationStartCode threw an exception with the following error message: Could not load file or assembly 'file:///D:\API\bin\DocumentDB.Spatial.Sql.dll' or one of its dependencies. The module was expected to contain an assembly manifest..]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9942412
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261
、(なしの成功と)以下の修正を試してみました:
- APIターゲットフレームワークを4.5に変更し、再起動しました - それでも同じエラーです。
- リビルド - まだ同じエラー
- dll DocumentDb.Spatial.Sql.dllは、Webアプリケーション& Web APIプロジェクトと同じです。
I質問を投稿する前にファイルパスを編集しました。そのパスはD:\ API \ bin \ DocumentDB.Spatial.sql.dllのようになります。誤解を招いて申し訳ありませんが、質問も同様に更新されます。 それにもかかわらず、reg編集ファイルを試しても、レジストリですべてのエントリが更新されますが、利用できるログはありません。 – Vikram
申し訳ありませんが、このregファイルを作成した後に追加するのを忘れていました。ダブルクリックしてレジストリの変更を入力する必要があります。あなたはそれをやりましたか? – Piotr
はい、既にそれを行い、最後に情報のキャプチャを開始しました。 LOG:アセンブリのダウンロードに成功しました。ファイルの設定を試みています:D:¥API¥bin¥DocumentDB.Spatial.Sql.dll LOG:ダウンロードキャッシュ設定フェーズに入ります。 ERR:ファイルからマニフェストのインポートを抽出中にエラーが発生しました(hr = 0x80131018)。 ERR:セットアップがhr = 0x80131018で失敗しました。 ERR:アセンブリのセットアップを完了できませんでした(hr = 0x80131018)。プロービングが終了しました。 ***アセンブリバインダーのログエントリ(2011/08/4 @ 9:20:43 AM)*** 操作が失敗しました。 バインド結果:hr = 0x80131018。説明はありません。 – Vikram