在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
只是一個念頭,有32位的DLL的x64機器上運行? – Giedrius
@Giedrius:我的環境是Win Vista家庭高級版(32位) –