locked
How to solve "Could not load file or assembly ..." error? RRS feed

  • Question

  • User260076833 posted

    Hello,

    I have some reports in my application, and I remember that I had to update the report services to 11.0.0 some time ago in order to get my things work.

    However, when I publish my application to my web server, I keep getting errors because of missing assemblys, like the one below.

    What I am doing repeatedly is:

    • Identify the missing assembly, e. g. "Microsoft.SqlServer.Types" like below.
    • Locate the assembly in my project's Reference section.
    • Set "copy local" to true for this assembly.

    However, I find that some assemblies are not in my Reference section. I have to add them, in order to set "copy local" to true. But how can my application work without them locally?

    Finally, is this the recommended way of solving such errors?

    What's going on here?

    Thanks
    Magnus

    Server Error in '/' Application.
    
    Could not load file or assembly 'Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
    
    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 'Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
    
    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 'Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' 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: 
    
    
    [FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.Types, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.]
       Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatWriter.Write(Object obj, Boolean verify, Boolean assertOnInvalidType) +0
       Microsoft.ReportingServices.ReportIntermediateFormat.Persistence.IntermediateFormatWriter.WriteVariantOrPersistable(Object obj) +73
       Microsoft.ReportingServices.ReportPublishing.ReportPublishing.CreateHashForCachedDataSets() +273
       Microsoft.ReportingServices.ReportPublishing.ReportPublishing.InternalCreateIntermediateFormat(Stream definitionStream, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash) +92
       Microsoft.ReportingServices.ReportPublishing.ReportPublishing.CreateIntermediateFormat(Byte[] definition, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash) +82
       Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileOdpReport(PublishingContext reportPublishingContext, IDataProtection dataProtection, PublishingErrorContext errorContext, String& reportDescription, String& reportLanguage, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash) +165
       Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext, IDataProtection dataProtection) +204
    
    [ReportProcessingException: An unexpected error occurred in Report Processing.]
       Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext, IDataProtection dataProtection) +989
       Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot) +203
    
    [DefinitionInvalidException: The definition of the report 'apl/psv/rpt/Empfang2/Empfang.rdlc' is invalid.]
       Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot) +269
       Microsoft.Reporting.LocalService.GetCompiledReport(PreviewItemContext itemContext, Boolean rebuild, ControlSnapshot& snapshot) +228
       Microsoft.Reporting.LocalService.CompileReport() +29
       Microsoft.Reporting.LocalService.Microsoft.Reporting.ILocalProcessingHost.CompileReport() +5
       Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession() +61
    
    [LocalProcessingException: An error occurred during local report processing.]
       Microsoft.Reporting.WebForms.LocalReport.EnsureExecutionSession() +150
       Microsoft.Reporting.WebForms.LocalReport.SetParameters(IEnumerable`1 parameters) +58
       Governica.apl.psv.rpt.Empfang2.Empfang2.bindReport(Int32 idx) +612
       Governica.apl.psv.rpt.Empfang2.Empfang2.Page_Load(Object sender, EventArgs e) +101
       System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
       System.Web.UI.Control.OnLoad(EventArgs e) +92
       System.Web.UI.Control.LoadRecursive() +54
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772
    
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34249

    Friday, September 25, 2015 3:26 AM

Answers

  • User1724605321 posted

    Hi Yeoman ,

    Finally, is this the recommended way of solving such errors?

    AFAIK , It is the common way to solve this kind of error .The error occurs when assembly is missing in the published (deployed environment) .If you are unsure of its dependencies, we usually make that assembly to copylocal=true and redeploy, repeat this iteratively .

    Best Regards,

    Nan Yu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 25, 2015 5:01 AM

All replies

  • User1724605321 posted

    Hi Yeoman ,

    Finally, is this the recommended way of solving such errors?

    AFAIK , It is the common way to solve this kind of error .The error occurs when assembly is missing in the published (deployed environment) .If you are unsure of its dependencies, we usually make that assembly to copylocal=true and redeploy, repeat this iteratively .

    Best Regards,

    Nan Yu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 25, 2015 5:01 AM
  • User13850534 posted

    I suggest you publish the application locally then ftp to your hosting space. Normally, this way is to make sure it will work with no file missing.

    Friday, October 2, 2015 3:20 AM