Visual Studio 2013 Publish Database to Azure

2019-06-15 05:09发布

I have created a new "Database" project in Visual Studio 2013. I have set the Target platform to "Windows Azure SQL Database". The project is nearly empty, with the exception of one .sql file to create a Schema.

When I try to publish the project, it takes several minutes and ends with:

Creating publish preview... Failed to import target model [database_name]. Detailed message Unable to reconnect to database: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

I have tested the connection string, and it works.

What do I need to do to publish to Azure? Thanks.

3条回答
在下西门庆
2楼-- · 2019-06-15 05:50

Like Hesham mentioned in the comments, I also had this issue with the new Basic tier of Azure SQL Database. Switching the tier to Standard S0 size fixed the issue. So if you're having issues with the Basic tier, try scaling up to publish, then scale back down when you're finished.

查看更多
Emotional °昔
3楼-- · 2019-06-15 06:01

Check this answer from MSDN forum, worked with me perfectly!

In order to change the command timeouts used in Visual Studio 2013 you will need to change the following registry setting:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0\SQLDB\Database\QueryTimeoutSeconds

Source:

http://social.msdn.microsoft.com/Forums/sqlserver/en-US/7e869f10-529b-41af-b54f-709a420308f6/publish-database-to-a-new-basic-scale-db-from-vs2013-times-out?forum=ssdsgetstarted

查看更多
Ridiculous、
4楼-- · 2019-06-15 06:04

I had experienced the same problem and was able to resolve it by changing the 'Connect Timout' value to 0 in the 'Publish Database' dialog.

  1. In the 'Target database connection:' field, click 'Edit...'.
  2. In 'Connection Properties' dialog, click 'Advanced...'.
  3. In the 'Initialization' section, set 'Connect Timeout' to 0.

Link to screencapture...I don't yet have enough points to publish an image. :)

My project had been taking 2-3 minutes before failing with the timeout. After the setting change, it successfully published within a minute.

I hope that helps.

查看更多
登录 后发表回答