Saturday, 15 March 2014

Connection Error with SQL Azure and Entity Framework on Azure Website -


Where to start, but whenever I publish my ASP.NET website Azure, any page There is a message saying "Access to database" error. There was an error while processing your request. " I open the remote debugger (which is flickering because it refuses to attach half of the time) and I find that when an error occurs when trying to reach the entity framework. The error varies between "network related or instance-specific" error, or "login unsuccessful" error (which may be the result of previous error, I do not really know).

ADOnate Connection String returns SQL Ezu

  server = TCP: [server name] .database.windows. Net, 1433; Database = Ensemble Music Webdatabase; User id = user @ [servername]; Password = (password); Trusted Contacts / False; Connection timeout = 30;  

But every implementation (putting in the EF metadata string, converting the server into a data source, etc.) still gives me the same login error

I'm pretty sure This connection is a problem with the string, but the infuriating part is that I have tried every possible combination that I can think of (Entity Framework Metadata, in any possible way, SQL Ezur Database ADOnetCan Using the expression string, changing the ejour is a website connection string under the Config tab, just by using a simple connection string ... etc).

I have removed and reconstructed the unit framework model at least 5 times, and each time I successfully connect to a server and it successfully reads my database and makes the right model. Keep it on the host and it works. The problem is that when I publish, it can not access the database and keeps these login failure errors (login details are the same when I set the EF model).

I think this might be something to do with a firewall, because I can access DB locally on server config with an approved firewall IP, but the website itself can be accessed to the database Can not access (I also have Ezur service box enabled). What I'm really doing now is a loss for it, because I just want to get some data from the database and display it on the page (any user, not just application), but I understand this It does not come in how complex it can be.

Can anyone tell me in the right direction? I tried every tutorial and example on MSDN and I did not find any solution at such a job.

Thank you, Shaun

I realized that I have a connection completely Found in a complete disturbance with the stars and the best way to fix it was simply to start over again. I removed the examples of my Azure website and database, created the database first (also made a correct login) and when creating a new website, Azure gave me the option to include the database I just created Now I have a right connection The string that Azer has generated, but safe (because Metadata confused the connection strings and I had the same problem again I did not want to be) I am not using the unit framework and I am using only normal SqlClient queries, because the website only requests two objects from one database.

I think now I have got a correct and functional string, I can see it and really understand where I was wrong and how to protect it, if I use the Anti-Fake Framework Finish it.


No comments:

Post a Comment