Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 13, 2013 @ 14:06
    Jeroen Breuer
    0

    Could not load file or assembly System.Data.SqlServerCe

    Hello,

    I've got an Umbraco v6 site which works local, but the website doesn't work on the staging server. I'm getting the following error:

    Could not load file or assembly 'System.Data.SqlServerCe, Version=4.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 'System.Data.SqlServerCe, Version=4.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 'System.Data.SqlServerCe, Version=4.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 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.]
       System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes) +0
       System.Reflection.RuntimeAssembly.GetExportedTypes() +122
       Umbraco.Core.TypeFinder.GetTypesWithFormattedException(Assembly a) +199
       Umbraco.Core.TypeFinder.GetTypes(Type assignTypeFrom, IEnumerable`1 assemblies, Boolean onlyConcreteClasses) +161
       Umbraco.Core.PluginManager.LoadViaScanningAndUpdateCacheFile(TypeList typeList, TypeResolutionKind resolutionKind, Func`1 finder) +53
       Umbraco.Core.PluginManager.ResolveTypes(Func`1 finder, TypeResolutionKind resolutionType, Boolean cacheResult) +1373
       Umbraco.Web.WebBootManager.InitializeApplicationEventsResolver() +76
       Umbraco.Core.CoreBootManager.Initialize() +565
       Umbraco.Web.WebBootManager.Initialize() +51
       Umbraco.Core.UmbracoApplicationBase.StartApplication(Object sender, EventArgs e) +100
    
    [HttpException (0x80004005): Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.]
       System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +3985477
       System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +191
       System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +325
       System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
       System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375
    
    [HttpException (0x80004005): Could not load file or assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11524352
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4782309
    
    Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

    Is there anything I need to do for sql ce on the server?

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 13, 2013 @ 14:09
    Jeroen Breuer
    0

    Btw I'm not even using sql ce so I don't even need it.

    Jeroen

  • Morten Christensen 596 posts 2773 karma points admin hq c-trib
    Mar 13, 2013 @ 14:12
    Morten Christensen
    101

    You should have the following entry in your web.config - under <system.data> <DbProviderFactories>

    <add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />

    Check that the version of System.Data.SqlServerCe.dll in the bin folder corresponds to the version specfied in the above section.

    - Morten

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Mar 13, 2013 @ 14:17
    Stefan Kip
    2

    Also had some sites where I had to add this to the web.config:

    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <dependentAssembly>
                <assemblyIdentity name="System.Data.SqlServerCe" publicKeyToken="89845dcd8080cc91" />
                <bindingRedirect oldVersion="4.0.0.0" newVersion="4.0.0.1" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>

    It redirects to 4.0.0.1, while the assembly version of 4.0.0.1 states it's version 4.0.0.0. Kind of weird stuff is going on with SQL CE and versioning.

    Just try this and Morten's suggestion and you'll get it fixed I guess :-) 

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Mar 13, 2013 @ 14:22
    Jeroen Breuer
    0

    I was missing the System.Data.SqlServerCe.dll file in the bin folder. Strange that it works local without that dll, but it's fixed now. Thanks :-).

    Jeroen

  • Stefan Kip 1614 posts 4131 karma points c-trib
    Mar 13, 2013 @ 14:23
    Stefan Kip
    0

    Nah, you probably have SqlCE installed in the GAC on your machine.

Please Sign in or register to post replies

Write your reply to:

Draft