c# - Where to place connection string in web.config -
my web.config looks :
<configuration> <configsections> <!-- more info on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <appsettings> <add key="webpages:version" value="3.0.0.0" /> <add key="webpages:enabled" value="false" /> <add key="clientvalidationenabled" value="true" /> <add key="unobtrusivejavascriptenabled" value="true" /> </appsettings> <system.web> <compilation debug="true" targetframework="4.5.1" /> <httpruntime targetframework="4.5.1" /> </system.web> <runtime>
when add together connection string below <configuration>
error saying 1 <configsections>
element allowed. should set connection string?
just place within <configuration>
right after </configsections>
f.e.
<configuration> <configsections> <!-- more info on entity framework configuration, visit http://go.microsoft.com/fwlink/?linkid=237468 --> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> </configsections> <connectionstrings> <add name="defaultconnection" connectionstring="blablabla" providername="system.data.sqlclient" /> </connectionstrings> <appsettings> <add key="webpages:version" value="3.0.0.0" /> <add key="webpages:enabled" value="false" /> <add key="clientvalidationenabled" value="true" /> <add key="unobtrusivejavascriptenabled" value="true" /> </appsettings> <system.web> <compilation debug="true" targetframework="4.5.1" /> <httpruntime targetframework="4.5.1" /> </system.web> ...
c# asp.net-mvc connection-string
No comments:
Post a Comment