c# - How to use different databases bewteen local and cloud execution -


i have asp.net mvc4 solution deploy on azure. solution connects sql database.

i know if solution can configured that, when run on local machine (i.e. while developping/debuging) uses local database, , when it's run in cloud (i.e. on azure) uses the cloud database.

i know sort of configuration possible storage account (blob, queue) connection strings, far haven't been able find equivalent databases connection string.

thanks willing me that.

you have configure web.config file set right connection string. local database need :

    <add name="defaultconnection" connectionstring="data source=(localdb)\v11.0;initial catalog=mydb;integrated security=sspi;attachdbfilename=|datadirectory|\mydbmdf" providername="system.data.sqlclient" /> 

then add web.release.config file use transformation statement change connection string, that.

 <connectionstrings>     <add name="defaultconnection" connectionstring="data source=xxx.database.windows.net,1433;initial catalog=xxx;user id=xxx@xxx;password=xxx;" providername="system.data.sqlclient" xdt:transform="replace"/>  </connectionstrings> 

and done.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -