title: Entity Framework not playing nicely with Oracle
body: <p>I have implemented a web service that uses some extremely simple linq queries using Entity Framework attaching to an Oracle 11g database.  This works fine locally running in visual studio.  When I deploy this web service to our development box it is not working.  First I was getting an error that:</p>
  
  <p><em>The specified store provider cannot be found in the configuration, or is not valid.</em></p>
  
  <p>I did some research and read some posts about modifying the web.config (or the machine.config) to have this entry:</p>
  
  <pre><code>  &lt;system.data&gt;
  &lt;DbProviderFactories&gt;
    &lt;add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory, Oracle.DataAccess, Version=4.112.3.0, Culture=neutral, PublicKeyToken=89b483f429c47342" /&gt;
  &lt;/DbProviderFactories&gt;
  </code></pre>
  
  <p></p>
  
  <p>I chose to put it in the web.config.  After I did that, I started getting the error:</p>
  
  <p><em>Could not load file or assembly 'Oracle.DataAccess, Version=2.0.50727, Culture=neutral, PublicKeyToken=89b483f429c47342' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)</em></p>
  
  <p>I then decided to install odp.net on the server.  After that I started getting the error:</p>
  
  <p><em>An error occurred creating the configuration section handler for system.data: Column 'InvariantName' is constrained to be unique. Value 'Oracle.DataAccess.Client' is already present. (D:\Duke\SmartGridWS\web.config line 107)</em></p>
  
  <p>This of course led me to check the machine.config, and sure enough, the odp.net install put the same entry in the machine.config  So, now I have removed the duplicate web.config entry and am simply getting this error:</p>
  
  <p><em>The underlying provider failed on Open.</em></p>
  
  <p>Here is my connection string entry in my web.config:</p>
  
  <pre><code>&lt;add name="Entities" connectionString="metadata=res://*/EDMS.csdl|res://*/EDMS.ssdl|res://*/EDMS.msl;provider=Oracle.DataAccess.Client;provider connection string=&amp;quot;DATA SOURCE=EDMSPT01;PASSWORD=*redacted*;USER ID=*redacted*&amp;quot;" providerName="System.Data.EntityClient" /&gt;
  </code></pre>
  
  <p>Pretty stumped here.  Mad props to the wizard who knows what is going on here. </p>