【问题标题】:Could not find schema information for the element 'castle'找不到元素“城堡”的架构信息
【发布时间】:2009-11-13 06:05:54
【问题描述】:

我正在我的 web.config 中创建一个自定义标签。我首先在 configSections 部分下编写了以下条目。

<section name="castle"
           type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,
         Castle.Windsor" />

但是,当我尝试在 configuration 节点内创建 castle 节点时,如下所示

<castle>
    <components>
    </components>
</castle> 

我收到以下错误消息:“*找不到元素 '**castle'* 的架构信息。” "***找不到元素 '**components'*** 的架构信息。"

我错过了什么吗?我找不到原因。而且,如果我仍然运行该应用程序,我会收到以下错误“在与此域关联的配置文件中找不到“Castle”部分。

Ps.// 示例来自第 99 页的“Pro ASP.NET MVC Framework”/Steven Sanderson/APress ISBN-13 (pbk): 978-1-4302-1007-8。

感谢您的帮助

================================================ ==============

由于我相信完全按照书中所说的做了并且没有成功,所以我用不同的术语问同样的问题。 如何使用以上信息添加新节点?

================================================ ===============================

谢谢。我按照你说的做了,没有两个警告。但是,我提出了一个新的重大警告:

“命名空间 'MyWindsorSchema' 中的元素 'configuration' 在命名空间 'MyWindsorSchemaconfigSections' /strong>'。预期的可能元素列表:'包括、属性、设施、组件'在命名空间'MyWindsorSchema'。"

【问题讨论】:

    标签: c# asp.net-mvc castle-windsor web-config


    【解决方案1】:

    您得到的并不是阻止您运行应用程序的错误。这只是 Visual Studio 发出的警告,因为它不知道配置文件中的 castle 节点。您可以使用模式来启用智能感知。下载Castle Windsor Schema文件,看看里面的readme.txt。它告诉您将windsor.xsd 放在硬盘上的某个位置,然后在配置文件中引用它:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration xmlns="MyWindsorSchema"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="MyWindsorSchema file://S:\Common\Windsor\windsor.xsd">
    
        <configSections>
            <section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" />
        </configSections>
    
        <castle>
            <components>
            </components>
        </castle>
    </configuration>
    

    【讨论】:

      猜你喜欢
      • 2012-12-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-20
      • 2013-11-29
      • 2017-09-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多