简体   繁体   中英

Issue deploying SQL Server database from local machine to SQL Azure

I have a database I've created on my local machine that I can't seem to correctly deploy to SQL Azure. I'm deploying two databases, including the one that provides user membership.

Every time I attempt this, when I try to login and access to the database is attempted, I receive a The system cannot find the file specified error:

I've tried deploying the database every way I could from Microsoft SQL Management Studio - by right clicking my databases and "Deploy Database to SQL Azure", by generating drop and create data only SQL scripts and running these against an existing target database, by creating a bacpac and importing this and all of these have the same result.

I've double checked connection strings in my .NET MVC applications web.config and these are all correct.

Interestingly, if I run my website locally with connection strings that pointed to my updated Azure SQL db, everything works fine - but on my Azure Website I always get the same results.

您的问题实际上看起来像是连接字符串问题,但是如果由于Google而导致其他人最终无法解决,则可以使用以下方法在Azure SQL Db上解决孤立的用户:

ALTER USER <user_name> WITH Login = <login_name>;

I am not a AZURE expert, but when moving DB's from one server to another sometimes user's get orphaned making the DB not accessible.

Can you run this command on the AZURE DB via SQL MANAGEMENT STUDIO?

exec sp_change_users_login 'Report'

It will tell you what username and UserSSID may be orphaned. If indeed there is a returned record run

EXEC sp_change_users_login 'Auto_Fix', '[[UserName_goes_here]]'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM