Reputation: 1
I have a team project and I'm trying to publish the app at Azure, which I successfully did. I was able to get our database to Azure SQL server, but now I'm struggling with connecting the app with this database.
Originaly the app is working with a .mdf file locally, but now, when I'm publishing the app, I want to use the DB at azure server. I changed all the connection strings of .mdf
file
(@"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename =" + Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory + @"..\..\..\PATH"))
in the code to the azure database connection string
(@"Data Source = Server=tcp:nameofserver.database.windows.net,1433;Initial Catalog=sqlmusicdb;Persist Security Info=False;User ID=...;Password=...;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;")
but after publishing, the app is not connected to database, as it is writing
AN ERROR OCCURRED WHILE PROCESSING YOUR REQUEST
Any help, please? Thanx.
Upvotes: 0
Views: 240
Reputation: 11246
Your connection string is formatted incorrectly. Remove the
Data Source =
at the very beginning of your connection string and it should work.
Upvotes: 3