我有一个关于在 MVC3 Web 应用程序中使用 LightSpeed 的问题。我正在创建一个 REST Api 项目,我想在其中使用 LightSpeed,但官方配置指南非常模糊。官方文档说需要将以下几行添加到文件 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 文件没有指定任何这些。
我不确定在哪里放置这个配置。