.net Firebird Embedded-尝试打开文件时出错

.net Firebird Embedded-尝试打开文件时出错,.net,nhibernate,firebird-embedded,.net,Nhibernate,Firebird Embedded,我想用Firebird 2.5。嵌入.NET4.0项目中的NHibernate3.2。firebird提供程序的代码非常好。但是当我尝试配置NHibernate时 Configuration = new Configuration().Configure(); UPD: 当我尝试构建会话工厂时 Factory = Configuration.BuildSessionFactory(); 出现以下错误: 文件C:\MYDB.FBD的CreateFile打开操作期间发生I/O错误 尝试打开文件时

我想用Firebird 2.5。嵌入.NET4.0项目中的NHibernate3.2。firebird提供程序的代码非常好。但是当我尝试配置NHibernate时

Configuration = new Configuration().Configure();
UPD:

当我尝试构建会话工厂时

Factory = Configuration.BuildSessionFactory();
出现以下错误:

文件C:\MYDB.FBD的CreateFile打开操作期间发生I/O错误 尝试打开文件时出错

在app.config中,一切看起来都很好


我猜firebird embedded独占使用该文件,当您打开另一个会话时,它会尝试连接到同一个文件并抛出

以下选项之一有助于:

保持全局连接并进行OpenSessionglobalConnection; 实现IConnectionProvider以分发单个数据库连接
因为我没有看到解决方案,我将添加我发现的内容-不管这篇文章有多旧: 您必须调用FirebirdSql.Data.FirebirdClient.FbConnection.CreateDatabaseConnectionString;在使用数据库之前

问候
Juy Juka

我创建了一个单独的项目,它只包含nhibernate的配置,并且得到了相同的错误。。。也许nhibernate在此阶段在内部创建了几个会话?您实现了IConnectionProvider吗?我正在尝试实现它。谢谢你的建议!FB 2.5 embedded允许多个同时连接到同一数据库文件。为什么要为嵌入式数据库指定LOCALHOST?请尝试将此属性保持为空。@AndreiK。我试过了。但一切都没有改变。目前,我正在寻找一些关于实现IConnectionProvider的信息
    <configSections>
    <section
        name="hibernate-configuration"
        type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
    />
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
    <session-factory>
            <property name="connection.driver_class">NHibernate.Driver.FirebirdClientDriver</property>
            <property name="connection.connection_string">
                Server=localhost;
                ServerType=1;
                Database=C:\MYDB.FBD;
                User=SYSDBA;Password=masterkey
            </property>
            <property name="show_sql">true</property>
            <property name="dialect">NHibernate.Dialect.FirebirdDialect</property>
            <property name="command_timeout">60</property>
            <property name="query.substitutions">true 1, false 0, yes 1, no 0</property>
    </session-factory>
</hibernate-configuration>
<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>