on 2015 Aug 05 8:35 PM
I am running into problems trying to run an EF6 application on other PCs other than my dev PC. The dev PC has the SQL Anywhere 12.0.1.42314 EBF installed. Using the SQL Anywhere Deployment Wizard ('Deploy to Windows'), I created an MSI package of the client bits of SA. This package was then installed on the testing machine. I then copied and pasted the bin folder of my app to shared folder and tried running it on the test PC.
When the app gets to creating the DBContext, it throws the following error (which has inner exceptions going two levels deep):
ProviderIncompatibleException:
An error occurred accessing the database. This usually means that the connection to the database failed. Check that the connection string is correct and that the appropriate DbContext constructor is being used to specify it or find it in the application's config file. See http://go.microsoft.com/fwlink/?LinkId=386386 for information on DbContext and connections. See the inner exception for details of the failure.
at System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)
...
ProviderIncompatibleException: The provider did not return a ProviderManifestToken string.
at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
...
ArgumentException: The connection is not of type 'SAConnection'.
at iAnywhere.Data.SQLAnywhere.SAProviderServices.GetDbProviderManifestToken(DbConnection connection)
....
I've checked the machine.config file(s) in Microsoft.Net\\Framework\\v4.0 and Framework64\\v4.0 and found the SA 12 data provider declared in the DbProviderFactories section.
I've checked the GAC (by opening Explorer to C:\\Windows\\Assembly) and found v12.0.1.42314 of iAnywhere.Data.SQLAnywhere and iAnywhere.Data.SQLAnywhere.v3.5 in there. I also found various older versions of the iAnywhere.Data.SQLAnywhere in there as well. Not sure if they are causing any issues. (I haven't tried cleaning out the older versions of the SA 12 client from the test PC yet).
The dev PC has v12.0.1.42314 of various iAnywhere.VSIntegration & iAnywhere.VSPackage assemblies. The test PC has the VS assemblies but they are v12.0.1.31522 and 11.0.1.20442 (again, not sure if this has any effect on my issue)
I've tried manually copying iAnywhere.Data.SQLAnywhere.EF6.dll and iAnywhere.Data.SQLAnywhere.v4.5.dll into the test app's folder. No change in behaviour.
I made a bare bones test application that creates an SAConnection ADO.Net object directly and then opens the connection. It works fine on the test PC, so the issue is somewhere with how entity framework creates connections.
I'm pretty stumped at this point. Any help would be greatly appreciated.
Request clarification before answering.
Wow... literally seconds after posting my question I clicked on one of the related questions on the side bar and found my answer: SetupVSPackage /v 6.
Argh...
So it seems that the SA deplyment wizard doesn't know about EF6. Is there a better way to deploy the SA ADO.Net client to my users other than manually running SetupVSPackage /v 6 for each of them?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do your customers/client need to do Visual Studio development? If they do you will need to add the extra steps to your own custom/customized installer. Much will depend on the previously installed VS and EF software/support.
If it helps any, the V17 documentation article .NET client deployment has more complete info. on the EF6 integration; than the V16 or V12 will.
I've also found that I can add the following to my app's config file to get EF6 to work:
<system.data> <dbproviderfactories> <clear/> <add name="SQL Anywhere 12 Data Provider" invariant="iAnywhere.Data.SQLAnywhere" description=".Net Framework Data Provider for SQL Anywhere 12" type="iAnywhere.Data.SQLAnywhere.SAFactory, iAnywhere.Data.SQLAnywhere.EF6, Version=12.0.1.42314, Culture=neutral, PublicKeyToken=f222fc4333e0d400"/> </dbproviderfactories> </system.data>
I tried it out on another PC that had v12.0.1.31523 of the SQL Anywhere client installed, which is much older and not EF6 compatible and it worked.
Now I can just deploy my EF6 app with iAnywhere.Data.SQLAnywhere.EF6.dll and don't have to run SetupVSPackage /v 6 or even have to install the newest SQL Anywhere ADO.Net drivers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
30 | |
8 | |
8 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.