0

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.

3
  • please share the entire error Commented Dec 5, 2016 at 14:29
  • that's it, nothing more, just that an error occured.. but on that side it is supposed to show some info and hypertext to pick an user from DB. now i'm setting logs on azure, to see, what's happening exactly. Commented Dec 5, 2016 at 14:38
  • @Maemi what you posted isn't an error. It's whan the end user would see if the web site crashed. Add logging to your application, log all unhandled exceptions and check the generated error messages. Using Application Insights is a quick solution to this Commented Dec 5, 2016 at 16:33

1 Answer 1

3

Your connection string is formatted incorrectly. Remove the

Data Source =

at the very beginning of your connection string and it should work.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.