2011-09-20 89 views
0

在ASP.NET MVC项目中(使用Entity Framework 4.1代码的第一种方法),我添加了对C:\ Program Files文件的引用\ FirebirdClient \ FirebirdSql.Data.FirebirdClient.dll。在ASP.NET MVC 3项目中无法加载Firebird嵌入式服务器(无法加载DLL'fbembed')

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> 

连接字符串看起来是这样的(数据库是不暴露出来的,应该从实体框架生成):

<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

只是一个念头,有32位的DLL的x64机器上运行? – Giedrius

+0

@Giedrius:我的环境是Win Vista家庭高级版(32位) –

回答

1

你不应该重命名fbembed.dll到fbclient.dll 。但是你也可以在连接字符串中使用ClientLibrary(检查FbConnectionStringBuilder类)参数来指定名称(和路径)。

0

定义路径到您fbembed.dll与 “ClientLibrary” 你的ConnectionString

样品:

<add name="myconn" connectionString="User=SYSDBA;Password=masterkey;Dialect=3;Database=|DataDirectory|mydatafile.fdb;ServerType=1;ClientLibrary=AbsolutePathToDll\fbembed.dll" />