I was using an .mdf
for connecting to a database
and entityClient
. Now I want to change the connection string so that there will be no
I have solved this way.
Step 1: Open Internet Information Service Manager
Step 2: Click on Application Pools in left navigation tree.
Step 3: Select your version Pool. In my case, I am using ASP .Net v4.0. If you dont have this version, select DefaultAppPool.
Step 4: Right click on step 3, and select advanced settings.
Step 5: Select Identity in properties window and click the button to change the value.
Step 6: Select Local System in Built-in accounts combo box and click ok. That's it. Now run your application. Everything works well.
Codeproject Solution : the-underlying-provider-failed-on-open
Make sure that each element value in the connection string being supplied is correct. In my case, I was getting the same error because the name of the catalog (database name) specified in the connection string was incorrect.
I had a similar issue with exceptions due to the connection state, then I realized I had my domain service class variable marked as static (by mistake).
My guess is that once the service library is loaded into memory, each new call ends up using the same static variable value (domain service instance), causing conflicts via the connection state.
I think also that each client call resulted in a new thread, so multiple threads accessing the same domain service instance equated to a train wreck.
I got rid of this by resetting IIS, but still using Integrated Authentication
in the connection string.
I was also facing the same issue. Now I have done it by removing the user name and password from the connection string.
This can also happen if you restore a database and the user already exists with different schema, leaving you unable to assign the correct permissions.
To correct this run:
USE your_database
EXEC sp_change_users_login 'Auto_Fix', 'user', NULL, 'cf'
GO
EXEC sp_change_users_login 'update_one', 'user', 'user'
GO