I am struggling getting my Website working with SQLServerCe 4.0. I am getting the following error message: [ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.] System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1420567 System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name) +362 System.Data.Entity.Internal.LazyInternalConnection.Initialize() +49 System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel() +10 System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +265 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +17 System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +62 System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15 System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +37 System.Linq.Queryable.Count(IQueryable`1 source) +50 Tips.Controllers.TipsController.InitWebData(WebData data) in TipsController.cs:146 The connection-string I am using is the following: <add name="Tips" connectionString="data source=|DataDirectory|Tips.sdf;Persist Security Info=False;" providerName="System.Data.SqlServerCe.4.0" /> Everything is working fine on my local machine. A different thread of this forum is suggesting to copy the binaries of SQLServerCe to the bin-Folder of my Website. I tried this, but without success. I copied the following DLLs (all from folder "Program files\Microsoft SQL Server Compact Edition\v4.0" on my Laptop with Windows 7 64 bit) to the bin folder: sqlceca40.dll sqlcecompact40.dll sqlceer40EN.dll sqlceme40.dll sqlceoledb40.dll sqlceqp40.dll sqlcese40.dll Is there anything missing or did I do something wrong in general? Thanks in adavnce!
Yes, the error message is the same. I started completely from scratch on the server side again, i.e.: create new directory ("tips" in my case) in VS2010 execute from menu Build --> Publish follow the instructions on http://stackoverflow.com/questions/...-4-to-work-with-asp-net-mvc-2/3223450#3223450 The only thing I found was, that the file-size of Program Files\Microsoft SQL Server Compact Edition\v4.0\Desktop\System.Data.SqlServerCe.dll is 465.248 bytes, whereas the one on the server (distributed via publish of my application) is 296.816 bytes. The current error-message looks like this: Server Error in '/tips' Application. Unable to find the requested .Net Framework Data Provider. It may not be installed. 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.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed. 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: [ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.] System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) +1420567 System.Data.Entity.Internal.LazyInternalConnection.TryInitializeFromAppConfig(String name) +362 System.Data.Entity.Internal.LazyInternalConnection.Initialize() +49 System.Data.Entity.Internal.LazyInternalConnection.get_ConnectionHasModel() +10 System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +265 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +17 System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +62 System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15 System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +37 System.Linq.Queryable.Count(IQueryable`1 source) +50 Tips.Controllers.TipsController.InitWebData(WebData data) in TipsController.cs:157 Tips.Controllers.TipsController.Index() in TipsController.cs:91 lambda_method(Closure , ControllerBase , Object[] ) +40 System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +188 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27 System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMethodWithFilters>b__12() +56 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +267 System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +20 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +190 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +329 System.Web.Mvc.Controller.ExecuteCore() +115 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +94 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10 System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55 System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +31 System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7 System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8970061 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
It seems like you might still be missing some .dll's. This link should help you with adding the correct .dll's to your application locally before deploying them on the server: http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx
I checked your link. I copied all the required (as mentioned in the link). I still get the same error message. I really do not know, what I could do to get it running. My entry in web.config looks like this: <add name="Tips" connectionString="data source=|DataDirectory|Tips.sdf;Persist Security Info=False;" providerName="System.Data.SqlServerCe.4.0" /> The DLLs on site are the ones from C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Private (the directories amd64 and x86) as well as the 2 DLLs from C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Desktop. The latter 2 I have copied directly to the bin-folder, the others are copied with the directory, i.e. they are located in bin\amd64 and bin\x86. I have no idea, which additional DLLs I could need.
Please see this link: http://msdn.microsoft.com/en-us/library/system.data.sqlserverce.aspx I'm not sure if there is a .dll name System.Data.SqlServerCe.dll. You might also want to try to see if enabling 'Full' trust would correct the issue: http://support.Winhost.com/KB/a657/changing-the-default-aspnet-trust-level.aspx The error message indicates it cannot reference this assembly.
The issue with the different sizes of the DLL I have fixed now. The one with 296.816 was the version 3.5. I changed my References to use version 4.0. The URL is http://www.club97.net/tips I have added the <system.web>-part to my web.config as suggested, but am still getting the same error-message.
The bin-directory of my deployed webpage looks like this: \---bin | EntityFramework.dll | EntityFramework.xml | Microsoft.Web.Infrastructure.dll | Microsoft.Web.Infrastructure.xml | Newtonsoft.Json.dll | Newtonsoft.Json.pdb | Newtonsoft.Json.xml | System.Data.SqlServerCe.dll | System.Data.SqlServerCe.Entity.dll | System.Web.Helpers.dll | System.Web.Helpers.xml | System.Web.Mvc.dll | System.Web.Mvc.xml | System.Web.Razor.dll | System.Web.Razor.xml | System.Web.WebPages.Deployment.dll | System.Web.WebPages.Deployment.xml | System.Web.WebPages.dll | System.Web.WebPages.Razor.dll | System.Web.WebPages.Razor.xml | System.Web.WebPages.xml | Tips.dll | Tips.pdb | +---amd64 | | sqlceca40.dll | | sqlcecompact40.dll | | sqlceer40EN.dll | | sqlceme40.dll | | sqlceqp40.dll | | sqlcese40.dll | | | \---Microsoft.VC90.CRT | Microsoft.VC90.CRT.manifest | msvcr90.dll | README_ENU.txt | +---App_Data | Tips.sdf | \---x86 | sqlceca40.dll | sqlcecompact40.dll | sqlceer40EN.dll | sqlceme40.dll | sqlceqp40.dll | sqlcese40.dll | \---Microsoft.VC90.CRT Microsoft.VC90.CRT.manifest msvcr90.dll README_ENU.txt I also checked with ProcessExplorer, if really the SqlServerCe Version 4.0 is referenced when starting the App on my Laptop:
Please see this link: http://social.msdn.microsoft.com/Forums/da-DK/vseditor/thread/7b4f353b-77fd-427c-976b-5968abc88c13 and double check the web.config file in the /tips directory. Look in the <DbProviderFactories> section. It may be misconfigured.
Thank you, now it's working. I added the following lines to web.config (the one located in the root dir): <system.data> <DbProviderFactories> <add name="Microsoft SQL Server Compact Data Provider" invariant="System.Data.SqlServerCe.3.5" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=3.5.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/> <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"/> </DbProviderFactories> </system.data>