We are trying to create an Entity Data model (edmx) file using Database first approach for Oracle Db.( We already have a running version of edmx for SQL Server).
Installed ODP.NET package which includes Oracle.ManagedDataAccess.dll and Oracle.ManagedDataAccess.EntityFramework.dll in Visual studio 2017 for Framework 4.5 via Nuget Packages
Manually modified the connection string for Oracle as
<connectionStrings>
<add name="FacetsDataModel"
connectionString="metadata=res://*/EntityDataModel.csdl|res://*/EntityDataModel.ssdl|res://*/EntityDataModel.msl;provider=System.Data.OracleClient;provider connection string=”Data Source=***;User Id=**;Password=***;”;" providerName="Oracle.ManagedDataAccess.Client" />
</connectionStrings>
The above approach didn't work because we found out that we are missing ODP.Net Managed Provider in the system. So we tried installing ODT Tools for Visual Studio 2013(didn’t work) uninstalled the same and installed 2017(still the same issue)
We found out that we missed ODAC (Oracle Data Access Components), so we installed the same but still, we didn't get the ODP.Net Managed Data Provider.
We checked the machine.config file from the below path: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config
When we tried searching for a solution, we got the below link ODP.NET Managed - Unable to find requested.Net Framework Data Provider
Point 11 -- They have mentioned modifying the machine.config file by including ODP.NET, Managed Driver Under section. After modifying the machine.config file, our visual studio got crashed.
As mentioned in the link, we checked with Registry key file and check if RegKey exists or not.
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed
A managed ODP.NET driver does not show up in Data Source dialogue
But in our system, there is no such folder exists named AssemblyFoldersEx in the specified path.
You missed several information, for example what is in your config file machine.config. Also you did not provide us any error message. Statements as "The above approach didn't work" are not very helpful.
Anyway I will try to give you some hints:
ODAC (Oracle Data Access Components) is a collection of various providers (ODP.NET managed and unmanaged, ODBC, OLE DB). Perhaps you selected the wrong component while installation.
HKLM\SOFTWARE\Wow6432Node\Microsoft.NETFramework\v4.0.30319\AssemblyFoldersEx\odp.net.managed is not used anymore. Usually the installation script should have deleted it. You Registry should look like this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v2.0.50727\AssemblyFoldersEx\ODP.Net]
#="c:\\oracle\\product\\12.2\\odp.net\\bin\\2.x"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\ODP.Net]
#="c:\\oracle\\product\\12.2\\odp.net\\bin\\4"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess]
#="c:\\oracle\\product\\12.2\\odp.net\\managed\\common"
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\.NETFramework\v4.0.30319\AssemblyFoldersEx\Oracle.ManagedDataAccess.EntityFramework6]
#="c:\\oracle\\product\\12.2\\odp.net\\managed\\common\\EF6"
Of course you have to set folders according to your system.
Related
Just installed ODAC for Visual Studio 2017 version 19.3 from here: https://www.oracle.com/database/technologies/dotnet-odacmsi-vs2017-downloads.html to replace ODT for Visual Studio 2017 NuGet Package. Then I noticed my Oracle NuGet packages were gone in my VS solution, and I had to re-add them. But this time I used Oracle.ManagedDataAccess 19.3 (previously had used 12.2.1100), and Oracle.ManagedDataAccess.EntityFramework 19.3 (previously used 12.2.1100).
Now my EDMX gets an error when I try to open it: "Error 168: The provider did not return a ProviderManifest instance. The type initializer for 'OracleInternal.Common.ProviderConfig' threw an exception."
I found an interesting answer by Mitaka here: Entity Framework: The provider did not return a providermanifest instance, so I opened my EDMX with XML Text Editor and found my ProviderManifestToken="12.1". So just for grins, I tried "19.3" and "19.1" but neither worked.
Anybody know the magic value? I'm just hoping that is how to solve the error. Thanks.
Got it. "18.0"
It actually updated itself after I got a bunch of other kinks worked out including "There is a duplicate 'oracle.manageddataaccess.client' section defined." Turns out the definition for Oracle.ManagedDataAccess was in my WebAPI web.config and also the machine config. Had to update THIS specific machine.config:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config - do a search on "managed" and comment out in 3 places.
Then it let me create a connection in Visual Studio 2017 Server Explorer and open the EDMX. Finally the EDMX update wizard is no longer aborting on the Data Connection screen. Back in business.
I reinstalled ODAC Oracle but keep getting following error
"Oracle Data Provider for .NET has been installed without a machine-wide configuration. However, a version of Oracle Data Provider for .NET has been detected in the Global Assembly Cache which may be incompatible. Please remove Oracle Data Provider for .Net from Global Assembly Cache an restart Visual Studio"
Should I care about this warning?
I did a lot of stuff which didn't helped.
But one thing did.:
open visual Studio Command prompt in admin mode
https://learn.microsoft.com/en-us/dotnet/framework/tools/developer-command-prompt-for-vs
there you have to use gacutil /l to list all assemblies
https://learn.microsoft.com/en-us/dotnet/framework/tools/gacutil-exe-gac-tool
Then delete every entry which includes oracle:
gacutil /u [assembly name]
you can get the assembly name out of the list before. Just use the term before the first comma (e.g. Oracle.ManagedDataAccess)
After that I opened Visual Studio and the error message disappeared.
What happened was, that in the machine.config were entries which I needed to delete. Which one you have to delete shows the error while you debugg the code.
Hope it will help.
When trying to build/run a solution that the rest of my teams is using without issues, I keep getting the following error messages.
At runtime it throws exception when instantiating the DbContext: "The specified store provider cannot be found in the configuration, or is not valid"
With an inner exception: "Unable to find the requested .Net Framework Data Provider. It may not be installed"
With the exact same code/project/configuration, 3 other team mates have no issues with this.
We use VS2013, EF 5.0, Oracle Client for .NET, Windows 7 x64
The connection string:
metadata=res://*/BpmModel.csdl|res://*/BpmModel.ssdl|res://*/BpmModel.msl;provider=Oracle.ManagedDataAccess.Client;provider connection string="DATA SOURCE=BpmOracle;PASSWORD=xxxxxxx;PERSIST SECURITY INFO=True;USER ID=xxxxxx;" providerName="System.Data.EntityClient"
So far we have tried:
Uninstalling and reinstalling VS2013
Installing VS2014 Update 4
Created and recreated the solution and workspace about 3-4 times
Entity Framework is installed
TNSNames.ora is correct
Any other things we could try to solve this puzzle?
I've solved the issue.
Switching to a 32-bit application in IIS did the trick.
Details:
Open IIS
Un-twirl the connections list (Most likely the computer name)
Click on Application Pools
For each of the applications listed:
Right click >> Advanced Settings
Set "Enable 30-Bit Applications" to True
Do you have your oracle provider registered in your app.config/web.config in the provider section? Check out this and this for reference.
My solution to this problem was to add the required configuration in Web.config, installing through NuGet the missing package.
Right click your solution or project, click on Manage NuGet packages, and install the missing Oracle reference. This should modify your Web.config with the reference.
I still cannot use EF with Firebird in VS2013 pro and Win7 pro !
Here's what I have done :
I have created a new class library for my dal project, and imported the ef6 and the firebird provider via nuget like said in this page http://www.nuget.org/packages/FirebirdSql.Data.FirebirdClient-EF6/
Then I copied the fb provider to some place and use gacutil to register it into the cache:
C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\gacutil -i fibirdprovierpath
Please note that I used the gacutil from the netfx4.5.1 (don't know if it change something)
After that I grabbed the ddex dlls, put them somewhere, change the regfiles that came with (32/64), for the path and ran them.
I have also modified the machine.config (32/64) to reference the Firebird provider .
Now, I can add a Firebird connection without any problem in the servers window, I can even create a Winforms pp that uses a Firebird dataset, BUT when I want to add an .edmx model, the Firebird option is unavailable, I have only SQL Server.
Make sense to anyone please !!!
Is this not related to your problem? http://tracker.firebirdsql.org/browse/DNET-522
i finally fugured out how to fix that !
with the registry files there is another subfolder named withSDK and it was empty,
so i searched for an older ddex files , edited the registry files that are located in that withsdk folder and voila !
I just upgraded my host to MVC 3 but I'm trying to do a "hello world" using SQLCE 4.0 but I just got:
Sorry, an error occurred while
processing your request.
I see my layout and everything but instead of data I see that.
On localhost is working as expected
I have:
<add name="PruebaContext" connectionString="Data Source=|DataDirectory|db.sdf" providerName="System.Data.SqlServerCE.4.0"/>
as connectionString.
I put the sdf as part of the project, I added the System.Data.SqlServerCE.dll to the project with the local copy to true.
I have no more ideas. The connString, the dll is in /bin and is working in localhost.
Any ideas?
Thanks.
EDIT
I have some logs now:
Without the "System.Data.SqlServerCE.dll" on /bin:
Unable to find the requested .Net Framework Data Provider. It may not be installed.
System.ArgumentException: Unable to find the requested .Net Framework Data Provider. It may not be installed.
Fine enough. They don't have SqlServerCE4.
With the Dll on local copy, AKA /bin:
Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
Exception Details: System.Data.SqlServerCe.SqlCeException: Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
The KB says that I need the dll from x86 and amd64. I read somewhere that if I copy two directories to /bin, like: /bin/x86 and /bin/amd64 . I copied that folders from the private folder of SqlServerCE 4 installation folder. Now I got:
Possible file version mismatch detected between ADO.NET Provider and native binaries of SQL Server Compact which could result in an incorrect functionality. This could be due to the presence of multiple instances of SQL Server Compact of different versions or due to wrong binaries with same name as SQL Server Compact binaries. Please install SQL Server Compact binaries of matching version.
Ok. On the root folder of SQLServerCE4 I have some dlls too, so I deleted that two folders and copied that dll to /bin:
Could not load file or assembly 'file:///C:\HostingSpaces\jesusrod\foxandxss.net\wwwroot\mvc3\bin\sqlceca40.dll' or one of its dependencies. The module was expected to contain an assembly manifest.
I think that I tried all things. Scottgu said that SqlServerCE 4 should work on any server without installation.
I don't like to respond to my own answer, but after hours of work I have the answer!
We need:
NuGet (Better than copying the dll's from program file)
With NuGet we install:
EFCodeFirst
SqlServerCompact
EFCodeFirst.SqlServerCompact
The problem was that EF need another dll for SQL CE 4 (System.Data.SqlServerCe.Entity.dll) and we need to put some configuration on web.config:
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<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>
With that, all is working. I have seen like 5 different errors, so we need:
The 2 dll from SQL CE 4, the EF dll, the config in web.config and the native dll (from the package directory where NuGet downloads the library).
It seems that the web.config config is pointing to a concrete version of the SQL CE .dll and the version of the RTM package is different. I can't find the concrete version so I use the .dll from NuGet.
That's all, SQL CE 4 + EF on a remote host.
Just use menu "Project/Add Deployable Dependencies..."
I'm not sure if it is Visual Studio 2010 SP 1 only.
You need to make sure you have the native SQL CE 4.0 dlls in your private application directory (e.g. \bin) in addition to the managed one.
Copy them from "C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0\Private\amd64" (or x86 if you have a 32-bit app).
It may also be wise to deploy the MSVCR90.dll and it's manifest too. Have a look at the documentation in C:\Program Files (x86)\Microsoft SQL Server Compact Edition\v4.0
for more information about the required DLLs and redistribution.
This looks like a problem that's caused by having multiple intermediate bits of data left in a project, where you've replaced included files without cleaning up.
I'd recommend doing a Build->Clean all, followed by making sure that all of your references are to the new, correct DLLs, and then making sure that none of the old files or references are still around anywhere in your project. Attempt to rebuild once that is done.
Since this is a hello world project, it might be easier to just start from scratch with a new project, and include the correct dlls in there.
try installing SQL CE manually.
http://www.microsoft.com/download/en/details.aspx?id=17876
Good Luck.
I was having the same problem. Trying to put a code-first SQL CE 4.0 app into play on my goDaddy account.
I started messing around with various DLL files based upon the thread above and other tutorials, but nothing seemed to work. Something was missing. Then I read about the Add Deployable Dependencies response.
I did that, which created _bin_deployableAssemblies folder. Then I deleted everything from my bin folder except my core project's DLL and copied everything from _bin_deployableAssemblies into the bin folder.
I cleaned out everything in the bin folder on my goDaddy app and resynced the files. That worked. The app loads and if I make codefirst changes to the classes, the dbcontext recreates the database for me. Of course, I don't want that in production, but I wanted to know that everything was working.
I did try using the ASP tutorial about deploying an MVC app to a hosting environment (they use Cytanium hosting as their example), but it didn't work for me on GoDaddy. I had to copy files manually.
Thanks all. This was a huge step for me being able to feel comfortable continuing in MVC and EF.