I'm creating a Custom tag in my web.config. I first wrote the following entry under the configSections section.
我正在我的web.config中创建一个自定义标记。我首先在configSections下编写了以下条目。
<section name="castle"
type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler,
Castle.Windsor" />
But, when I try to create a castle node inside the configuration node as below
但是,当我尝试在配置节点中创建castle节点时,如下所示
<castle>
<components>
</components>
</castle>
I get the following error message:"*Could not find schema information for the element '**castle'*." "***Could not find schema information for the element '**components'***."
我得到以下错误消息:“*无法为元素**castle **找到模式信息。”*** *** *** *** *** *** *** *** *** **
Am I missing something? I can't find why. And, if I run the application anyway, I get the following error "Could not find section 'Castle' in the configuration file associated with this domain."
我遗漏了什么东西?我找不到原因。而且,如果我无论如何运行这个应用程序,我得到以下错误“在与这个域相关联的配置文件中找不到'Castle'部分”。
Ps.// The sample comes from "Pro ASP.NET MVC Framework"/Steven Sanderson/APress ISBN-13 (pbk): 978-1-4302-1007-8" on page 99.
//这个样本来自“Pro - ASP”。NET MVC框架"/Steven Sanderson/APress ISBN-13 (pbk): 978-1-4302-1007-8"在第99页。
Thank you for the help
谢谢你的帮助
============================================================
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Since I believe to have done exactly what's said in the book and did not succed, I ask the same question in different terms. How do I add a new node using the above information?
因为我相信,我在书中所讲的,并没有成功,我用不同的方式问了同样的问题。如何使用上述信息添加新节点?
=============================================================================
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Thank you. I did what you said and do not have the two warnings. However, I've go a big new warning:
谢谢你!我照你说的做了,没有这两个警告。然而,我有一个新的警告:
"The element 'configuration' in namespace 'MyWindsorSchema' has invalid child element 'configSections' in namespace 'MyWindsorSchema'. List of possible elements expected: 'include, properties, facilities, components' in namespace 'MyWindsorSchema'."
名称空间“MyWindsorSchema”中的元素“配置”在名称空间“MyWindsorSchema”中有无效的子元素“configSections”。可能的元素列表:“包含、属性、设施、组件”在名称空间“MyWindsorSchema”中。
1 个解决方案
#1
2
What you get is not an error that will prevent you from running your application. It is just a warning that Visual Studio emits because it does not know the castle
node in a config file. You could use a schema to enable intellisense. Download the Castle Windsor Schema file and take a look at the readme.txt inside. It tells you to put windsor.xsd
somewhere on your hard drive and then reference it in the config file:
您得到的不是会阻止您运行应用程序的错误。这只是Visual Studio发出的警告,因为它不知道配置文件中的castle节点。您可以使用模式来启用智能感知。下载Castle Windsor模式文件并查看readme。txt里面。它告诉你要写温莎。您的硬盘上的某处,然后在配置文件中引用它:
<?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>
#1
2
What you get is not an error that will prevent you from running your application. It is just a warning that Visual Studio emits because it does not know the castle
node in a config file. You could use a schema to enable intellisense. Download the Castle Windsor Schema file and take a look at the readme.txt inside. It tells you to put windsor.xsd
somewhere on your hard drive and then reference it in the config file:
您得到的不是会阻止您运行应用程序的错误。这只是Visual Studio发出的警告,因为它不知道配置文件中的castle节点。您可以使用模式来启用智能感知。下载Castle Windsor模式文件并查看readme。txt里面。它告诉你要写温莎。您的硬盘上的某处,然后在配置文件中引用它:
<?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>