SQL connection error after deploying through VS te

2019-09-10 09:04发布

问题:

I have setup build for my WebAPI project through VS team service Builds for continuous integration and I am using VS team service release management continuous deployment to Azure Web App. I am not getting any errors while build or release however when I try to access my Apis through swagger, I get "A network-related or instance-specific error occurred while establishing a connection to SQL Server".

Here is what I have as a connection string in VSTS release definition -connectionString @{"xxxx"="Server=tcp:xxxx.database.windows.net,1433;Database=xxxxdb;User ID=xxxxdbuser@xxxx;Password=xxxx;Trusted_Connection=False;Encrypt=True;"}

This is my first attempt to setup CI/CD and I would appreciate any help.

Many thanks

回答1:

I had to create a connection string in my Web.config which is not named as defaultConnection and name it same as in my VSTS release definition.