首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >配置Lightspeed以在MVC3网站项目中使用

配置Lightspeed以在MVC3网站项目中使用
EN

Stack Overflow用户
提问于 2012-04-08 22:39:29
回答 1查看 297关注 0票数 0

我有一个关于在MVC3网络应用程序中使用LightSpeed的问题。我正在创建一个REST Api项目,其中我想使用LightSpeed,但official configuration guidelines相当模糊。官方文档称需要将以下行添加到文件web.config中:

代码语言:javascript
复制
<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中:

代码语言:javascript
复制
<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文件没有指定其中的任何一个。

我不知道该把这个配置放在哪里。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-04-09 02:20:37

好了,我知道怎么解决这个问题了。

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10063617

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档