asp.net - Enterprise library 4 dataconfiguration tag -
i using enterprise library data access. when running application, @ createdatabase() statement getting exception:
microsoft.practices.objectbuilder2.buildfailedexception unhandled user code message="the current build operation (build key build key[microsoft.practices.enterpriselibrary.data.database, null]) failed: value can not null or empty string. (strategy type microsoft.practices.enterpriselibrary.common.configuration.objectbuilder.configuredobjectstrategy, index 2)" source="microsoft.practices.objectbuilder2"
now, googled bit , found have place
<dataconfiguration defaultdatabase="localsqlserver"/>
but don't know where. right solution?
also, @ time of installing enterprise library didn't see connection string statement? so, wonder how take connection string web.config file.
in connection string section of web.config file have:
<remove name="localsqlserver"/> <add name="localsqlserver" connectionstring="data source=mstr;initial catalog=userdb;integrated security=true;" providername="system.data.sqlclient"/>
yes need add dataconfiguration
section web.config.
first need add dataconfiguration list of configurationsections in 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 need add connection strings web.config (you've done this):
<connectionstrings> <add name="localsqlserver" connectionstring="data source=mstr;initial catalog=userdb;integrated security=true;" providername="system.data.sqlclient"/> </connectionstrings>
then need add actual dataconfiguration section web.config:
<dataconfiguration defaultdatabase="localsqlserver"/>
you can use enterprise library configuration tool well.
Comments
Post a Comment