我有一个关于在MVC3网络应用程序中使用LightSpeed的问题。我正在创建一个REST Api项目,其中我想使用LightSpeed,但official configuration guidelines相当模糊。官方文档称需要将以下行添加到文件web.config中:
<configSections>
<section name="lightSpeedContexts"
type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection, Mindscape.LightSpeed" />
</configSections>
<lightSpeedContexts>
<add name="Test" />
</lightSpeedContexts>
<lightSpeedContexts>
<add name="Test" dataProvider="SQLite3" />
</lightSpeedContexts>我尝试将以下行添加到根目录中的web.config中:
<configSections>
<section name="lightSpeedContexts"
type="Mindscape.LightSpeed.Configuration.LightSpeedConfigurationSection, Mindscape.LightSpeed" />
</configSections>
<lightSpeedContexts>
<add name="Default" connectionStringName="Prod" dataProvider="MySQL5" />
</lightSpeedContexts>
<connectionStrings>
<add name="Prod" connectionString="server=localhost;User Id=production;password=xxx;Persist Security Info=True;database=CBS"/>
</connectionStrings>这在我启动Web应用程序时抛出一个异常,它告诉我configSections不能在应用程序中多次指定。默认情况下,根web.config文件没有指定其中的任何一个。
我不知道该把这个配置放在哪里。
发布于 2012-04-09 02:20:37
好了,我知道怎么解决这个问题了。
我移出了两个子web.config文件(在每个视图文件夹中)中的configSections,并将内容放在主web.config文件中,然后将lightSpeedContexts和connectionStrings添加到主web.config文件中。
https://stackoverflow.com/questions/10063617
复制相似问题