How to set database connection strings for continuous deployment from visual studio online

I have an MVC website that I can publish to the cerulean part from visual studio without any problems. In the publish wizard, I specified connection strings for the two databases associated with the website.

I am trying to configure continuous deployment for this site. When I check the change, the cloud build is created and completed. I also know that the changes are deployed. However, they are not deployed with connection information for the database, and I'm not sure how to install it.

I think that connecting to the database is a problem, because when I go to the site after deployment, I get this error:

System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5341687
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +546
System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, Boolean withFailover) +5353471
System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +145    
System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +923
System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +311

Since connection information is usually provided in the publish wizard, I had the intuition that the solution would be there. I tried to check my publish profile settings file in VSO, and then set "Path to Deployment Settings" in the build definition to this profile settings file:

Path to Deployment settings  $/<projectpath>/mysite.azurewebsites.net.PublishSettings

In addition, I added database connection strings to the publish settings file:

  <add name="CollateralContext" connectionString="<connection string from azure>" />
  <add name="UsersContext" connectionString="<connection string from azure>" />

But I use the same error stack trace when deploying the site.

, , azure Visual Studio "", , . , . , " " ..

?

!

+3
1

, .

Azure , :

http://azure.microsoft.com/en-us/documentation/articles/web-sites-configure/

:

  • ,
  • configure
  • " "

, ClassNameContext, ClassName ( Entity). , ClassName . - , , , .

+3

Source: https://habr.com/ru/post/1683692/


All Articles