Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

I am getting below error connecting to sql anywhere database from entity framework 6 Schema specified is not valid. Errors: Model11.ssdl(2,2) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'Sap.Data.SQLAnywhere'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.

I have added the provider in web.config as,

 <entityframework>
    <defaultconnectionfactory type="Sap.Data.SQLAnywhere.SAConnectionFactory, Sap.Data.SQLAnywhere.EF6, Version=17.0.4.20534, Culture=neutral, PublicKeyToken=f222fc4333e0d400">
    </defaultconnectionfactory>
    <providers>
      <provider invariantname="Sap.Data.SQLAnywhere" type="Sap.Data.SQLAnywhere.SAProviderServices, Sap.Data.SQLAnywhere.EF6, Version=17.0.4.20534, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/>
      <provider invariantname="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
    </providers>
  </entityframework>
  <connectionstrings>
    <add name="Entities1" connectionstring="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=Sap.Data.SQLAnywhere;provider connection string="UserID=dba;Password=sql;DataSourceName=WebPortalSybase17"" providername="System.Data.EntityClient"/>
  </connectionstrings>

asked 27 Jul '16, 17:17

madhukar's gravatar image

madhukar
11224
accept rate: 0%

edited 28 Jul '16, 03:55

Volker%20Barth's gravatar image

Volker Barth
40.2k361550822


That sounds like the provider has just not been registered correctly on that machine yet.

permanent link

answered 27 Jul '16, 18:19

Nick%20Elson%20SAP%20SQL%20Anywhere's gravatar image

Nick Elson S...
7.3k35107
accept rate: 32%

I have registered the providers using %SQLANY17%\Assembly\v4.5\SetupVSPackage.exe /install.I am able to add .edmx file with stored procedure from sybase database but when i call it Getting above error.I have entry in machine.config for sql anywhere as, <add name="SQL Anywhere 17 Data Provider" invariant="Sap.Data.SQLAnywhere" description=".NET Framework Data Provider for SQL Anywhere 17" type="Sap.Data.SQLAnywhere.SAFactory, Sap.Data.SQLAnywhere.v4.5, Version=17.0.4.20534, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/>

(27 Jul '16, 18:39) madhukar

The EF6 framework requires an additional 'version to install' switch when running SetupVSPackage.exe:

SetupVSPackage.exe /i /v EF6

That DCX article (see link) also shows how to set this up in your app.config. You will want to compare your changes to that.

Some of the config entries are required by Visual Studio. Some are for the .NetFramework ... I noticed your machine.config 'provider' addition was not identified as being part of a <system.data>, <dbproviderfactories> sections. If a DbProviderFactories is missing or the provider is not identified for that purpose, that may be a reason for the EF6 'lookup' to fail the way you are seeing.

At this moment I'm not exactly certain which 'layer' is throwing your error but it feels like the factory is the one that is failing to find the correct provider.

(28 Jul '16, 09:20) Nick Elson S...

Machine config does contain the the entry for DbProviderFactories as

<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=89845dcd8080cc9`enter code here`1"/>
      <add invariant="iAnywhere.Data.UltraLite" name="SQL Anywhere UltraLite.NET 12 Data Provider" description=".Net Framework Data Provider for SQL Anywhere UltraLite.NET 12" type="iAnywhere.Data.UltraLite.ULFactory, iAnywhere.Data.UltraLite,  Version=12.0.0.2483, Culture=neutral, PublicKeyToken=ff11483eb5a8c1a5"/>
      <add name="SQL Anywhere 16 Data Provider" invariant="iAnywhere.Data.SQLAnywhere" description=".Net Framework Data Provider for SQL Anywhere 16" type="iAnywhere.Data.SQLAnywhere.SAFactory, iAnywhere.Data.SQLAnywhere.v4.5, Version=16.0.0.20434, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/>
      <add name="SQL Anywhere 17 Data Provider" invariant="Sap.Data.SQLAnywhere" description=".NET Framework Data Provider for SQL Anywhere 17" type="Sap.Data.SQLAnywhere.SAFactory, Sap.Data.SQLAnywhere.EF6, Version=17.0.4.20534, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/>
    </dbproviderfactories>
  </system.data>

and also i had followed the process suggested by you like executing "SetupVSPackage.exe /i /v EF6" command. I am still not able to execute the procedure through .edmx. I wonder how it does allow me to add the .edmx with sql anywhere 17 driver but at the time of query execution it does give me the error for provider.

(28 Jul '16, 11:21) madhukar

Your web.config file snippet looks OK except:

Remove the SqlClient entry if you don't need it.

Use exact case for keywords in your app config file (yes, it is case-sensitive!). For example, entityframework => entityFramework, invariantname => invariantName, etc.

One thing to note. It looks like you have both 16.0 and 17.0 providers installed. Only one provider can be used with Visual Studio, and that is the last one you installed with SetupVSPackage. I usually avoid confusion by running the following at an administrator Command Prompt ...

SetupVSPackage /ua

SetupVSPackage /i /v ef6

(28 Jul '16, 12:53) JBSchueler

uninstalled 16.0 providers and also have correct case sensitive names in web.config still giving error.

(28 Jul '16, 15:53) madhukar
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×246
×69
×2

question asked: 27 Jul '16, 17:17

question was seen: 5,808 times

last updated: 28 Jul '16, 15:53