When trying to query data from Entity Framework, my code always return the following error:
The underlying provider failed on Open.
Here’s the screenshot.
Turn out the problem was on the Connection String for the entity.
In the config file, we have to include “Password” parameter in “connectionString” attribute.
<connectionStrings> <add name="SomeEntities" connectionString="metadata=res://*/Models.DB.csdl|res://*/Models.DB.ssdl|res://*/Models.DB.msl;provider=System.Data.SqlClient;provider connection string="Data Source=SERVER\INSTANCE;Initial Catalog=Database;User ID=username;Password=password;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" /> </connectionStrings>
Whoolaa, it works now!
UPDATE (03.07.2011): If you still see this error message when running on IIS, please read this post.
[…] you try to run your WCF Service in IIS and get the following error although you have already done this post? The underlying provider failed on […]
Wow, it worked! Thanks very much. Brilliant!
it didnt work for me.i already password had any suggesssion
Thank you Boss!!!… Thanks for this useful info
it worked perfectly for me…
Worked here too. Thanks a lot!
try changing application pool identity to network service
if not having password for sql server