Could not load file or assembly '...' or one of its dependencies

Thảo luận trong 'Lập trình web Asp.net' bắt đầu bởi admin, 29/7/13.

  1. admin
    Tham gia ngày:
    22/5/13
    Bài viết:
    4,994
    Đã được thích:
    1,215
    Điểm thành tích:
    113
    Giới tính:
    Nam
    Nếu vô tình bạn chạy web trên ISS 7 hoặc IIS8 trên win8 hoặc win7 64 bit bạn gặp lỗi hoặc tương tự. Bạn làm theo hướng dẫn ở dưới bài viết thì sẽ khắc phục được.

    [h=2]Could not load file or assembly 'WordReportDllC' or one of its dependencies. An attempt was made to load a program with an incorrect format.[/h] [FONT=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif] 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 'WordReportDllC' or one of its dependencies. An attempt was made to load a program with an incorrect format.

    Source Error:

    [TABLE="width: 100%"]

    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.
    [/TABLE]

    Assembly Load Trace: The following information can be helpful to determine why the assembly 'WordReportDllC' could not be loaded.

    [TABLE="width: 100%"]


    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].
    [/TABLE]

    Stack Trace:

    [TABLE="width: 100%"]


    [BadImageFormatException: Could not load file or assembly 'WordReportDllC' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0 System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +416 System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +166 System.Reflection.Assembly.Load(String assemblyString) +35 System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +190 [ConfigurationErrorsException: Could not load file or assembly 'WordReportDllC' or one of its dependencies. An attempt was made to load a program with an incorrect format.] System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +11250200 System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +388 System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +232 System.Web.Configuration.AssemblyInfo.get_AssemblyInternal() +48 System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +210 System.Web.Compilation.WebDirectoryBatchCompiler..ctor(VirtualDirectory vdir) +191 System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors) +54 System.Web.Compilation.BuildManager.CompileWebFile(VirtualPath virtualPath) +295 System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +476 System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile) +116 System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +175 System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert) +52 System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath) +50 System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, VirtualPath path, String pathTranslated, Boolean useAppConfig) +503 System.Web.MapHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +142 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +263
    [/TABLE]



    Nếu gặp lỗi trên bạn làm như sau:
    Tại giao diện ISS7 hoặc ISS8 bạn chọn
    [/FONT]Application pool-> nhắp chuật phải chọn Advanced setting[FONT=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif](lưu ý [/FONT]Advanced setting[FONT=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif] mà của pool lúc bạn cài đặt và chọn cho web thường mặc định là [/FONT]DefaultAppPool[FONT=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif]) tiếp theo bạn tìm tới [/FONT]"Enable 32-Bit Applications"[FONT=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif] [SUB]và cài đặt cho nó là "True".
    Chúc bạn thành công
    [/SUB]

    [/FONT]
     
    Cảm ơn đã xem bài:

    Could not load file or assembly '...' or one of its dependencies

  2. baocomy
    Tham gia ngày:
    26/10/16
    Bài viết:
    10
    Đã được thích:
    0
    Điểm thành tích:
    1
    Giới tính:
    Nữ
    cảm ơn ! bài viết hữu ích