【问题标题】:Configuring Lightspeed for use in MVC3 Web project配置 Lightspeed 以在 MVC3 Web 项目中使用
【发布时间】:2012-04-08 14:39:28
【问题描述】:

我有一个关于在 MVC3 Web 应用程序中使用 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 文件没有指定任何这些。

我不确定在哪里放置此配置。

【问题讨论】:

    标签: asp.net-mvc-3 configuration lightspeed


    【解决方案1】:

    好的,我找到了解决问题的方法。

    我移出了两个子 web.config 文件(在每个 Views 文件夹中)中的 configSections 并将内容放在主 web.config 文件中,然后我在主 web.config 文件中添加了 lightSpeedContexts 和 connectionStrings .

    【讨论】:

      猜你喜欢
      • 2011-07-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-23
      相关资源
      最近更新 更多