c# - Getting error 0004: Could not load System.Data.SqlServerCe.Entity.dll. Reinstall SQL Server Compact -
i working on asp.net web pages site sql server ce 4.0.
i believe sql server ce 4.0 database working fine. can connect without problems on dev machine , without entity framework.
once push site server, can connect fine without entity framework using connection string:
<add name="startersite" connectionstring="data source=|datadirectory|\startersite.sdf" providername="system.data.sqlserverce.4.0" />
my entity framework connection string looks this:
<add name="startersiteentities" connectionstring="metadata=res://*/app_code.productmodel.csdl|res://*/app_code.productmodel.ssdl|res://*/app_code.productmodel.msl;provider=system.data.sqlserverce.4.0;provider connection string="data source=|datadirectory|\startersite.sdf"" providername="system.data.entityclient" />
when try make ef database calls error message:
server error in '/' application.
schema specified not valid.
errors:
app_code.productmodel.ssdl(2,88) : error 0004: not load system.data.sqlserverce.entity.dll. reinstall sql server compact.description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code.
exception details: system.data.metadataexception: schema specified not valid.
errors:
app_code.productmodel.ssdl(2,88) : error 0004: not load system.data.sqlserverce.entity.dll. reinstall sql server compact.source error:
line 23: using (var db = new startersiteentities())
line 24: {
line 25: product = (from p in db.products
line 26: p.productid == productid
line 27: select p).firstordefault();source file: c:\sites\www.foosite.org\admin-ruf\admin-product-edit.cshtml line: 25
stack trace:
[metadataexception: schema specified not valid. errors: app_code.productmodel.ssdl(2,88) : error 0004: not load system.data.sqlserverce.entity.dll. reinstall sql server compact. ] system.data.metadata.edm.loader.throwonnonwarningerrors() +8610213 system.data.metadata.edm.loader.loaditems(ienumerable1 xmlreaders, ienumerable
1 sourcefilepaths) +189 system.data.metadata.edm.storeitemcollection.init(ienumerable1 xmlreaders, ienumerable
1 filepaths, boolean throwonerror, dbprovidermanifest& providermanifest, dbproviderfactory& providerfactory, string& providermanifesttoken, memoizer2& cachedctypefunction) +182 system.data.metadata.edm.storeitemcollection..ctor(ienumerable
1 xmlreaders, ienumerable1 filepaths) +244 system.data.metadata.edm.storemetadataentry.loadstorecollection(edmitemcollection edmitemcollection, metadataartifactloader loader) +90 system.data.metadata.edm.storeitemcollectionloader.loaditemcollection(storemetadataentry entry) +16 system.data.metadata.edm.metadatacache.loaditemcollection(iitemcollectionloader
1 itemcollectionloader, t entry) +163 system.data.metadata.edm.metadatacache.getorcreatestoreandmappingitemcollections(string cachekey, metadataartifactloader loader, edmitemcollection edmitemcollection, object& entrytoken) +191 system.data.entityclient.entityconnection.loadstoreitemcollections(metadataworkspace workspace, dbconnection storeconnection, dbproviderfactory factory, dbconnectionoptions connectionoptions, edmitemcollection edmitemcollection, metadataartifactloader artifactloader) +246 system.data.entityclient.entityconnection.getmetadataworkspace(boolean initializeallcollections) +586 system.data.entityclient.entityconnection.initializemetadata(dbconnection newconnection, dbconnection originalconnection, boolean closeoriginalconnectiononfailure) +75 system.data.entityclient.entityconnection.open() +150 system.data.objects.objectcontext.ensureconnection() +75 system.data.objects.objectquery1.getresults(nullable
1 formergeoption) +41 system.data.objects.objectquery1.system.collections.generic.ienumerable<t>.getenumerator() +36 system.linq.enumerable.firstordefault(ienumerable
1 source) +152 system.data.objects.elinq.objectqueryprovider.b__1(ienumerable1 sequence) +41 system.data.objects.elinq.objectqueryprovider.executesingle(ienumerable
1 query, expression queryroot) +59 system.data.objects.elinq.objectqueryprovider.system.linq.iqueryprovider.execute(expression expression) +133 system.data.entity.internal.linq.dbqueryprovider.execute(expression expression) +87 system.linq.queryable.firstordefault(iqueryable1 source) +251 asp._page_admin_ruf_admin_product_edit_cshtml.execute() in c:\sites\www.foosite.org\admin-ruf\admin-product-edit.cshtml:25 system.web.webpages.webpagebase.executepagehierarchy() +198 system.web.webpages.webpage.executepagehierarchy(ienumerable
1 executors) +69 system.web.webpages.webpage.executepagehierarchy() +131 system.web.webpages.startpage.runpage() +17 system.web.webpages.startpage.executepagehierarchy() +64 system.web.webpages.webpagebase.executepagehierarchy(webpagecontext pagecontext, textwriter writer, webpagerenderingbase startpage) +78 system.web.webpages.webpagehttphandler.processrequestinternal(httpcontextbase httpcontext) +116
version information: microsoft .net framework version:4.0.30319; asp.net version:4.0.30319.18044
what doing wrong?
deploy system.data.sqlserverce.entity.dll app, in c:\program files (x86)\microsoft sql server compact edition\v4.0\desktop\system.data.sqlserverce.entity on pc.
Comments
Post a Comment