-->

Update database feature not working in Publish Web

2019-05-03 01:56发布

问题:

I'm developing an ASP.NET Web Forms application under Visual Studio 2012. I'm using Web Deploy and Publish Web dialog for application deploy. I'm trying to deploy a database schema using the Update database feature. I entered a connection string pointing to remote SQL Server. If I click the "Test connection" button Visual Studio says test connection is succeeded.

Then I go to Preview tab and click the Preview database link.

And in the opened window I have the message

Web deployment task failed. (Could not generate deployment script. Unable to connect to target server. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD.)

Other project files are deployed normally. I'm able to connect to SQL Server using SQL Server Management Service. But why the database could not be updated? I tried to disable server firewall - with no luck.

  • Visual Studio Professional 2012
  • SQL Server 2012
  • Web Deploy 3.0

Update

All works fine if I use SQL Server Authentication with the sa login instead of Windows Authentication in connection string for DatabaseEntitiesRaw. But Windows Authentication works fine for SSMS, and I want to use it since I'm deploying only from computers within my company's domain. Is it true that dbDacFx doesn't work with Windows Authentication?

回答1:

Deploy script runs from AUTHORITY\LOCAL SERVICE user, so you have to add this user to SQL server. Do not foget to add db_owner role for the user.