Home » Categories » Multiple Categories |
How To Solve Problem with Connection String on EF (Entity Framework) 4 or above |
Article Number: 148 | Rating: 3/5 from 2 votes | Last Updated: Mon, Apr 1, 2013 at 10:20 PM
|
This article applies to anyone who uses Entity Framework (EF) type-of-codes on our shared server environment. Please be advised that when you host your database on our server, you will have to use the connection string on your web.config. The "usual" connection string on your web.config should be something similar to the one mentioned on this article. If you are using Entity Framework on your code, the connection string on your web.config will look something like this: <add name="conn_string" connectionString="metadata=res://*/App_Code.myApp.csdl|res://*/App_Code.myApp.ssdl|res://*/App_Code.myApp.msl;provider=System.Data.SqlClient;provider connection string="Data Source=data_source;uid=my_db_username;pwd=my_db_password;AttachDbFilename=App_Data\myApp.mdf;Integrated Security=True;Connect Timeout=30;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" /> Please be advised that the above connection string will not work on our server. When you have restored your database on our server, you must use the connection string determined by our server. Therefore, to rectify the issue, you must change the connection string on your web.config to something like this: <add name="conn_string" connectionString="metadata=res://*/App_Code.myApp.csdl|res://*/App_Code.myApp.ssdl|res://*/App_Code.myApp.msl;provider=System.Data.SqlClient;provider connection string="Data Source=our_SQL_Server_details;uid=my_db_uzsername;pwd=my_DB_password;Initial Catalog=my_DB_name;ConnectTimeout=30;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" /> Please pay close attention to the details in bold. - our_SQL_Server_details refers to the SQL Server detail specified on our Control Panel. Please see this article - my_db_username refers to the DB_username created on our Control Panel - my_db_password refers to the DB_password created on our Control Panel
- my_db_name refers to the DB_name created on our Control Panel
Please also take note that "Integrated Security" line on your web.config should be removed. If you still experience issues, please contact our Support Team by raising a support ticket via our Help Desk System |
Attachments
![]()
There are no attachments for this article.
|
Why do I suddenly receive the error message: "Compiler Error Message: The compiler failed with error code XXXXXXXXX"?
Viewed 17133 times since Wed, Feb 17, 2016
HTTP Error 502.5 - Process Failure error message when publishing an ASP.NET Core Website
Viewed 10713 times since Mon, Mar 27, 2017
Do you support ASP.NET MVC 6?
Viewed 4643 times since Wed, Feb 17, 2016
Do you allow custom COM components?
Viewed 2824 times since Tue, May 1, 2012
I receive this error message: "Directory Listing Denied. This Virtual Directory does not allow contents to be listed."
Viewed 10543 times since Mon, Apr 30, 2012
Can I have one database user associated to more than 1 MS SQL database?
Viewed 3279 times since Tue, May 1, 2012
Sample Code to Send email using ASP.NET 2
Viewed 9662 times since Tue, May 1, 2012
How to solve the Let’s Encrypt SSL on ASP.NET Core
Viewed 9477 times since Mon, Jul 17, 2017
Can I set up additional logins for my MySQL database?
Viewed 2895 times since Mon, Apr 30, 2012
How to Backup MSSQL Database by using "Export Dump"?
Viewed 250 times since Sun, Mar 9, 2025
|