WinHost Forums                

Go Back   WinHost Forums > Programming/troubleshooting forums > Databases

Reply
 
Thread Tools Search this Thread
Old 04-24-2012, 10:45 AM   #1
RobGruen
 
Join Date: Apr 2012
Posts: 7
SqlServerCe.4.0

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.In itializeContext() +265
System.Data.Entity.Internal.InternalContext.GetEnt itySetAndBaseTypeForType(Type entityType) +17
System.Data.Entity.Internal.Linq.InternalSet`1.Ini tialize() +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(WebDat a 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!
RobGruen is offline   Reply With Quote
Old 04-25-2012, 04:52 PM   #2
Elshadriel
WinHost Staff
 
Elshadriel's Avatar
 
Join Date: May 2011
Posts: 504
Are you receiving a new error message?
Elshadriel is offline   Reply With Quote
Old 04-26-2012, 11:57 AM   #3
RobGruen
 
Join Date: Apr 2012
Posts: 7
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
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.In itializeContext() +265
System.Data.Entity.Internal.InternalContext.GetEnt itySetAndBaseTypeForType(Type entityType) +17
System.Data.Entity.Internal.Linq.InternalSet`1.Ini tialize() +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(WebDat a data) in TipsController.cs:157
Tips.Controllers.TipsController.Index() in TipsController.cs:91
lambda_method(Closure , ControllerBase , Object[] ) +40
System.Web.Mvc.ActionMethodDispatcher.Execute(Cont rollerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(C ontrollerContext controllerContext, IDictionary`2 parameters) +188
System.Web.Mvc.ControllerActionInvoker.InvokeActio nMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.<>c__DisplayClass15.<InvokeActionMe thodWithFilters>b__12() +56
System.Web.Mvc.ControllerActionInvoker.InvokeActio nMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +267
System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMe thodWithFilters>b__14() +20
System.Web.Mvc.ControllerActionInvoker.InvokeActio nMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +190
System.Web.Mvc.ControllerActionInvoker.InvokeActio n(ControllerContext controllerContext, String actionName) +329
System.Web.Mvc.Controller.ExecuteCore() +115
System.Web.Mvc.ControllerBase.Execute(RequestConte xt requestContext) +94
System.Web.Mvc.ControllerBase.System.Web.Mvc.ICont roller.Execute(RequestContext requestContext) +10
System.Web.Mvc.<>c__DisplayClassb.<BeginProcessReq uest>b__5() +37
System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidD elegate>b__0() +21
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSy nchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
System.Web.Mvc.<>c__DisplayClasse.<EndProcessReque st>b__d() +31
System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThun k>b__0(Action f) +7
System.Web.Mvc.SecurityUtil.ProcessInApplicationTr ust(Action action) +23
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsync Result asyncResult) +59
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHan dler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +8970061
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +184


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272
RobGruen is offline   Reply With Quote
Old 04-26-2012, 03:03 PM   #4
Elshadriel
WinHost Staff
 
Elshadriel's Avatar
 
Join Date: May 2011
Posts: 504
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/2...net-mvc-3.aspx
Elshadriel is offline   Reply With Quote
Old 04-27-2012, 06:36 AM   #5
RobGruen
 
Join Date: Apr 2012
Posts: 7
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.
RobGruen is offline   Reply With Quote
Old 04-27-2012, 05:07 PM   #6
Elshadriel
WinHost Staff
 
Elshadriel's Avatar
 
Join Date: May 2011
Posts: 504
Please see this link:

http://msdn.microsoft.com/en-us/libr...lserverce.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/c...ust-level.aspx

The error message indicates it cannot reference this assembly.
Elshadriel is offline   Reply With Quote
Old 04-27-2012, 05:09 PM   #7
Elshadriel
WinHost Staff
 
Elshadriel's Avatar
 
Join Date: May 2011
Posts: 504
Oops. I missed this:

Quote:
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.
Is there a URL we can view?
Elshadriel is offline   Reply With Quote
Old 04-27-2012, 11:28 PM   #8
RobGruen
 
Join Date: Apr 2012
Posts: 7
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.
RobGruen is offline   Reply With Quote
Old 04-30-2012, 01:38 PM   #9
RobGruen
 
Join Date: Apr 2012
Posts: 7
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:
RobGruen is offline   Reply With Quote
Old 05-02-2012, 06:44 PM   #10
Elshadriel
WinHost Staff
 
Elshadriel's Avatar
 
Join Date: May 2011
Posts: 504
Please see this link:

http://social.msdn.microsoft.com/For...b-5968abc88c13

and double check the web.config file in the /tips directory. Look in the <DbProviderFactories> section. It may be misconfigured.
Elshadriel is offline   Reply With Quote
Old 05-03-2012, 03:16 AM   #11
RobGruen
 
Join Date: Apr 2012
Posts: 7
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>
RobGruen is offline   Reply With Quote
Reply

Bookmarks

Tags
compact edition, database, sqlserverce

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:30 AM.


vBulletin® ©Jelsoft Enterprises Ltd.