Developed an exe using .Net framework 4.0, EF 6.0. It works fine in machines where .Net framework 4.0, 4.5 full version installed.
But when I invoke the same exe from different machine's shared folder, it throws error. it is because of entityframework tag in the config.
Server Machine has shared folder with .Net 4.5 installed. SharedFolder contains the exe developed using .Net 4.0.
If user opens the exe of sharedFolder in servermachine, from clientmachine (4.0 installed) getting below error.
It works fine, when client and server machines have 4.5 framework.
Works, when opening directly in client (4.0) and server (4.5) machines.
Error
'System.Data.Entity.Internal.AppConfig' Type initializer for threw an exception
Stack Trace:
at System.Data.Entity.Internal.AppConfig.get_DefaultInstance()
at System.Data.Entity.DbContext..ctor(String nameOrConnectionString)
at ShipNet.Accounting.Data.SNACSEntities..ctor(String ConnectionString)
at ShipNet.Accounting.Data.Repository.BaseRepository..ctor()
at ShipNet.QnR.Presenter.frmMainPresenter.IView_GetSNAPSSystem()
at ShipNet.QnR2.UI.frmMain..ctor(String UserName)
at ShipNet.QnR2.UI.Program.Main(String[] args)
Inner Exception Source:
System.Configuration
.Net Framework : 4.0 Entity Framework : 6.0 database: sql server
my configuration file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="ERP-DB" connectionString="Data Source=testserver;Initial Catalog=db;user Id=**;Password=**" providerName="System.Data.SqlClient" />
</connectionStrings>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
</entityFramework>
<system.data>
<DbProviderFactories>
<add name="EF Caching Data Provider" invariant="EFCachingProvider" description="Caching Provider Wrapper" type="EFCachingProvider.EFCachingProviderFactory, EFCachingProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=def642f226e0e59b" />
<add name="EF Tracing Data Provider" invariant="EFTracingProvider" description="Tracing Provider Wrapper" type="EFTracingProvider.EFTracingProviderFactory, EFTracingProvider, Version=1.0.0.0, Culture=neutral, PublicKeyToken=def642f226e0e59b" />
<add name="EF Generic Provider Wrapper" invariant="EFProviderWrapper" description="Generic Provider Wrapper" type="EFProviderWrapperToolkit.EFProviderWrapperFactory, EFProviderWrapperToolkit, Version=1.0.0.0, Culture=neutral, PublicKeyToken=def642f226e0e59b" />
</DbProviderFactories>
</system.data>
</configuration>