2

I'm getting this error when i want to start my asp.net web app

The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) 
...

Line 22:     {
Line 23:         public ApplicationDbContext()
Line 24:             : base("DefaultConnection", throwIfV1Schema: false)
Line 25:         {
Line 26:         }

Its MVC web app connected to oracle database and I used EntinyFramework 6.1.3 over NuGet,

I'm using windows 7 64-bit, V.Studio 2015 and 32-bit ODAC 12c Release 4

I tried to set in Visual studio to start in x64 or x86, doesn't help..

Please give me some advice. Thank you.

Code behind: Web.config:

<configuration>
  <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="Oracle.ManagedDataAccess.Client" type="OracleInternal.Common.ODPMSectionHandler, Oracle.ManagedDataAccess, Version=4.12.1.0.2.4, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    <sectionGroup name="devExpress">
      <section name="themes" type="DevExpress.Web.ThemesConfigurationSection, DevExpress.Web.v16.1, Version=16.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
      <section name="compression" type="DevExpress.Web.CompressionConfigurationSection, DevExpress.Web.v16.1, Version=16.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
      <section name="settings" type="DevExpress.Web.SettingsConfigurationSection, DevExpress.Web.v16.1, Version=16.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
      <section name="errors" type="DevExpress.Web.ErrorsConfigurationSection, DevExpress.Web.v16.1, Version=16.1.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\aspnet-WebApplication1-20160811110342.mdf;Initial Catalog=aspnet-WebApplication1-20160811110342;Integrated Security=True"
      providerName="System.Data.SqlClient" />
    <add name="Model1" connectionString="DATA SOURCE=XXXXX;PERSIST SECURITY INFO=True;USER ID=XXXX"
      providerName="Oracle.ManagedDataAccess.Client"/>
    <add name="xpf.printing" connectionString="xpoprovider=MSSqlServer;data source=(localdb)\mssqllocaldb;attachdbfilename=|DataDirectory|\ReportService.mdf;integrated security=True;connect timeout=120" />
  </connectionStrings>
  ....
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb" />
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=4.12.1.0.2.4, Culture=neutral, PublicKeyToken=89b483f429c47342"/>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
    </providers>
  </entityFramework>
  ....
</configuration>

IdentityModels.cs :

using System.Data.Entity;
using System.Security.Claims;
using System.Threading.Tasks;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;

namespace WebApplication1.Models
{
    // You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
    public class ApplicationUser : IdentityUser
    {
        public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
            // Add custom user claims here
            return userIdentity;
        }
    }

    public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
    {
        public ApplicationDbContext()
            : base("DefaultConnection", throwIfV1Schema: false)
        {
        }

        public static ApplicationDbContext Create()
        {
            return new ApplicationDbContext();
        }
    }
}
4
  • you should down load from the Oracle site the 32Bite Oracle.DataClient and set the project to be x86 there is a known issue / bug with the 64bit client version and it will work on a 64 bit OS using the 32bit Oracle.DataAccess.Client; I work with this on a daily basis and I copy the dll into a dependency folder setting the CopyLocal =true property when I add the reference Commented Aug 11, 2016 at 14:25
  • how are you adding these references? nuget? Commented Aug 11, 2016 at 14:55
  • I posted more info bout my problem.. @MethodMan : im usin 32Bite Oracle.DataClient ... Didn't understand u about dll, from where to where to copy and what reference?? Thank you. Commented Aug 12, 2016 at 9:33
  • if you are not familiar about how to add a reference as well as setting the properties of the individual reference, then you will not be able to solve your problem.. sorry.. Commented Aug 12, 2016 at 14:05

1 Answer 1

1

I have the same bug and I has been fixed like this: You need change your web.config like this:

<entityFramework>
  <defaultConnectionFactory type="Oracle.ManagedDataAccess.EntityFramework.OracleConnectionFactory, Oracle.ManagedDataAccess.EntityFramework"></defaultConnectionFactory>
  <providers>
    <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342" />
    <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
  </providers>
</entityFramework>

And you need to install entityFramework 1. Install-Package EntityFramework -Version 6.1.1 2. Add reference from your link setup ODAC 12c Release 4 Oracle.ManagedDataAccess.EntityFramework.dll Oracle.ManagedDataAccess.dll to your project. It's will done

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.