我的 Castle ActiveRecord web.config 有什么问题

发布于 2024-09-10 07:10:50 字数 1556 浏览 4 评论 0原文

我正在尝试将我的 ASP.NET MVC 1 网站升级到版本 2。在执行此操作时,我还必须更新所有其他程序集。这也包括 Castle 的 ActiveRecord dll。这是我收到的错误:

配置错误描述:An 处理过程中发生错误 所需的配置文件 服务此请求。请查看 下面的具体错误详细信息和 修改你的配置文件 适当地。

解析器错误消息:错误 创建配置时发生 activerecord 的节处理程序: 异常已被抛出 调用的目标。

<configSections>
        <section name="activerecord" type="Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler, Castle.ActiveRecord" />
...
</configSections>

<activerecord isWeb="true" isDebug="false">
    <config>
        <add
        key="hibernate.connection.driver_class"
        value="NHibernate.Driver.SqlClientDriver" />
        <add
                key="hibernate.dialect"
                value="NHibernate.Dialect.MsSql2005Dialect" />
        <add
                key="hibernate.connection.provider"
                value="NHibernate.Connection.DriverConnectionProvider" />
        <add
                                key="hibernate.connection.connection_string"
                                value="Data Source=(local)\SQLEXPRESS;Initial Catalog=db;Integrated Security=SSPI;" />
    </config>
</activerecord>

我没有看到这里有什么问题,我添加了“休眠”。通过以下方式到密钥的开头:

http://www.castleproject .org/activerecord/documentation/v1rc1/manual/xmlconfigref.html

之前没有这个,所以我认为这可能就是它出现问题的原因。

I'm trying to upgrade my ASP.NET MVC 1 website to version 2. While doing this I'm having to update all of my other assemblies as well. This includes Castle's ActiveRecord dll as well. Here is the error I'm getting:

Configuration Error Description: An
error occurred during the processing
of a configuration file required to
service this request. Please review
the specific error details below and
modify your configuration file
appropriately.

Parser Error Message: An error
occurred creating the configuration
section handler for activerecord:
Exception has been thrown by the
target of an invocation.

<configSections>
        <section name="activerecord" type="Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler, Castle.ActiveRecord" />
...
</configSections>

<activerecord isWeb="true" isDebug="false">
    <config>
        <add
        key="hibernate.connection.driver_class"
        value="NHibernate.Driver.SqlClientDriver" />
        <add
                key="hibernate.dialect"
                value="NHibernate.Dialect.MsSql2005Dialect" />
        <add
                key="hibernate.connection.provider"
                value="NHibernate.Connection.DriverConnectionProvider" />
        <add
                                key="hibernate.connection.connection_string"
                                value="Data Source=(local)\SQLEXPRESS;Initial Catalog=db;Integrated Security=SSPI;" />
    </config>
</activerecord>

I don't see anything wrong here, I added "hibernate." to the beginning of the key's by following:

http://www.castleproject.org/activerecord/documentation/v1rc1/manual/xmlconfigref.html

It didn't have that before so I thought that may have been why it was acting up.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

清泪尽 2024-09-17 07:10:50

NHibernate 需要 ProxyFactoryFactory 的配置(就像消息中所说的那样)。最新的 ActiveRecord 版本附带了 Castle 代理工厂工厂,因此您可以像这样设置它:

<add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle"/>

确保您的应用程序中有对 NHibernate.ByteCode.Castle.dll、Castle.DynamicProxy2.dll、Castle.Core.dll 的

引用不需要设置 release_mode 属性,它是可选的。

NHibernate 2.0 中删除了配置属性的 hibernate. 前缀。您引用的 castleproject.org 页面适用于 Castle ActiveRecord RC1(非常),它使用了 NHibernate 的古老版本(1.0 或类似版本)。 ActiveRecord 的 XML 配置参考的最新文档位于此处

NHibernate needs the configuration for the ProxyFactoryFactory (just like the message says). The latest ActiveRecord release ships with the Castle proxy factory factory so you can set it up like this:

<add key="proxyfactory.factory_class" value="NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle"/>

Make sure you have a reference to NHibernate.ByteCode.Castle.dll, Castle.DynamicProxy2.dll, Castle.Core.dll in your application

You don't need to set the release_mode property, it's optional.

The hibernate. prefix for config properties was dropped in NHibernate 2.0. The castleproject.org page you quote is for Castle ActiveRecord RC1 (very old), which used an ancient version of NHibernate (1.0 or something like that). The latest docs for XML config reference for ActiveRecord is here.

飞烟轻若梦 2024-09-17 07:10:50

您可能缺少释放模式的键。

<添加键=“hibernate.connection.release_mode”值=“on_close”/>?

你们有活动记录部分吗?

;

我只是猜测,尝试一下然后告诉我们。

You might be missing a key for release mode.

<add key="hibernate.connection.release_mode" value="on_close"/>?

Do you have an Active Record section?

<section name="activeRecord" type="Castle.ActiveRecord.Framework.Config.ActiveRecordSectionHandler, Castle.ActiveRecord" requirePermission="false"/>

I'm only guessing, try it out and let us know.

丢了幸福的猪 2024-09-17 07:10:50

这就是我现在所拥有的:

<add
            key="connection.driver_class"
            value="NHibernate.Driver.SqlClientDriver" />
            <add
                    key="dialect"
                    value="NHibernate.Dialect.MsSql2000Dialect" />
            <add
                    key="connection.provider"
                    value="NHibernate.Connection.DriverConnectionProvider" />
            <add
                                key="connection.connection_string"

我更新到最新的 Castle Active Record 程序集 2.1.2 并且该错误消失了......现在我拥有了:

The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>

天哪......

Here's what I have now:

<add
            key="connection.driver_class"
            value="NHibernate.Driver.SqlClientDriver" />
            <add
                    key="dialect"
                    value="NHibernate.Dialect.MsSql2000Dialect" />
            <add
                    key="connection.provider"
                    value="NHibernate.Connection.DriverConnectionProvider" />
            <add
                                key="connection.connection_string"

I updated to latest Castle Active Record assemblies 2.1.2 and that error went away...now I have:

The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu</property>
Example:
<property name='proxyfactory.factory_class'>NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>

good gracious ...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文