1
I am using MVC 3, Entityframework 4 and Mysql database. I hosted my application on Locaweb. Unfortunately, I can’t connect the same thing to the database. Running the application on my local machine and connecting to the database hosted at Locaweb works perfectly. What to do?
What mistake you’re making?
– Andrew Paes
when I access the hosted website and try to make the connection to the database. on the login screen... I called on Ocaweb they said it’s a matter of security.. so when I run the local application works normally. But they could not tell me the solution rsrs error: The underlying Provider failed on Open.
– Jonathan R.
Put in the code portion of your connection, please, put in the stack trace as well. One of the probable causes is that Locaweb is using Integrated Security and the IIS user does not have access to the bank, confirm this with them. Also read on: http://blogs.msdn.com/b/dataaccesstechnologies/archive/2012/08/09/error-quot-the-underlying-provider-failed-on-open-quot-entity-framework-application.aspx
– Andrew Paes
Put the solution to generate the error on the screen, on the web.config debugmode=true. So when you put the application on the Locaweb server it should show you the error.
– Andrew Paes
Andrew, are you already with <Compilation debug="true" targetFramework="4.0"> do I need to do anything else in the controller that first calls the database? sorry I’m still new to Asp.net mvc try to connect, any login will give error: editorasuperavit.com.br
– Jonathan R.
Put the chunk of the c# code where you try to open the connection. Let’s see if it has anything to do with the transaction.
– Andrew Paes
so... I use that ado.net edmx... I don’t have a connection class, it automatically connects every time I make a request, like : Users user = db.usuarios.Single(item => item.Login == user.Login); if you want and have a time, I can show you via teamviwer
– Jonathan R.
Take a look at this - http://stackoverflow.com/a/3081776/2912399
– Andrew Paes
Old man, delete this message above. You cannot post personal data here for security reasons.
– Andrew Paes
tb did not work... no catch I put to show the stack trace... I am uploading let’s see what error will give
– Jonathan R.
If it’s working on your machine, then it’s probably one of the 2 things, either the Mysql driver on Locaweb is not installed or the IIS user is not allowed. You’ll have to open a call to them.
– Andrew Paes
so I’ve already opened a call... but they take a day to answer... so I’ll have to wait anyway! pq really this mto complicated solve this! rsrs thank you so much for your help ! so I get to solve put the solution :)
– Jonathan R.
Andrew takes a look at the stack The underlying Provider failed on Open. --- at System.Data.Entityclient.EntityConnection.Openstoreconnectionif(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) at System.Data.EntityClient.EntityConnection.Open() At sistemaeditora.Controllers.Autenticacaocontroller.Login(Usuarios Autenticacao)
– Jonathan R.
Test it here. http://blogs.msdn.com/b/brunoterkaly/archive/2010/12/entity-framework-deb.aspx
– Andrew Paes
Cara got it, I found a question in MSDN that the person was having a mistake similar to mine! <system.data> <Dbproviderfactories> <clear /> <add name="Mysql Data Provider" invariant="Mysql.Data.Mysqlclient" Description=". Net Framework Data Provider for Mysql" type="Mysql.Data.Mysqlclient.Mysqlclientfactory, Mysql.Data, Version=6.2.3.0, Culture=neutral, Publickeytoken=c5687fc88969c44d" /> </Dbproviderfactories> </system.data>
– Jonathan R.
just add this code to webconfig. Thanks a lot for the help keep being this good guy !!!
– Jonathan R.
Put that in for an answer. Hug
– Andrew Paes