在ASP.NET MVC项目中(使用Entity Framework 4.1代码第一种方法),我添加了对C:\ Program Files \ FirebirdClient \ FirebirdSql.Data.FirebirdClient.dll的引用。
Web.config中的配置如下所示:
<system.data>
<DbProviderFactories>
<remove invariant="FirebirdSql.Data.FirebirdClient"/>
<add
name="Firebird Data Provider"
invariant="FirebirdSql.Data.FirebirdClient" description="Firebird"
type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=2.6.5.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c"
/>
</DbProviderFactories>
</system.data>
连接字符串看起来像这样(数据库是非exresnd,应该从Entity Framework生成):
<add name="AdvertiserDatabase"
connectionString="ServerType=1;User=SYSDBA;Password=masterkey;Dialect=3;Database=|DataDirectory|AdvertiserDb.fdb"
providerName="FirebirdSql.Data.FirebirdClient"/>
将所有需要的文件(firebird.msg,icu * 30.dll)添加到 bin 文件夹中,还添加了文件夹intl和udf。
将fbembed.dll重命名为fbclient.dll。
在运行时,我收到以下错误: 无法加载DLL“fbembed”:找不到指定的模块。 (HRESULT异常:0x8007007E)
出了什么问题?这应该有效!
提前致谢
修改 在输出窗口中,我注意到以下消息(这让我很困惑):
WebDev.WebServer40.EXE' (Managed (v4.0.30319)): Loaded 'FB_965910463.dll'
A first chance exception of type 'System.DllNotFoundException' occurred in FB_965910463.dll
A first chance exception of type 'System.DllNotFoundException' occurred in FirebirdSql.Data.FirebirdClient.dll
A first chance exception of type 'System.Data.ProviderIncompatibleException' occurred in System.Data.Entity.dll
A first chance exception of type 'System.Data.ProviderIncompatibleException' occurred in EntityFramework.dll
A first chance exception of type 'System.Data.ProviderIncompatibleException' occurred in System.Web.Mvc.dll
A first chance exception of type 'System.Data.ProviderIncompatibleException' occurred in System.Web.Mvc.dll
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.dll
A first chance exception of type 'System.NotSupportedException' occurred in mscorlib.dll
答案 0 :(得分:1)
您不应将fbembed.dll重命名为fbclient.dll。但您也可以在连接字符串中使用ClientLibrary(检查FbConnectionStringBuilder类)参数来指定名称(和路径)。