Enterprise library 4 dataconfiguration tag

半城伤御伤魂 提交于 2019-12-05 15:45:58

Yes you need to add the dataConfiguration section to the web.config.

First you need to add dataConfiguration to the list of ConfigurationSections in your web.config:

<configSections>
    <section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</configSections>

Then you need to add your connection strings to the web.config (you've already done this):

<connectionStrings>
    <add name="LocalSqlServer" connectionString="Data Source=MSTR;Initial Catalog=USERDb;Integrated Security=true;" providerName="System.Data.SqlClient"/>      
</connectionStrings>

Then you need to add the actual dataConfiguration section to the web.config:

<dataConfiguration defaultDatabase="LocalSqlServer"/>

You can also use the Enterprise Library Configuration Tool to do this for you as well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!