login fail for windows authentication on a new server
I have a backup of my SQL database and restored on another computer. Now when I try to login to it programmatically using C# I get error:
Login failed for user 'new computer name'".
I am using windows authentication and my connection string looks like this:
Data Source=.\\sqlexpress;Initial Catalog="office_ session";Integrated Security=True
when I try Visual studio -> serve开发者_如何学Cr explorer -> connect to a database wizard everything works fine.
Thank you for your time.
If it's a website, is it running in Visual Studio? If so is it running under Cassini webserver or IIS Express? If so, check whether Windows authentication is on (press F4 when the webapplication project is selected).
It looks like your database was set up to use local users for authentication on the other computer. Integrated Security means that your Windows logon will be used to authenticate with the database.
Try granting database access to your user in SQL Server Management Studio. If you are unable to do this, change the connection string to use a different login.
精彩评论