none
A network-related or instance-specific error occurred while establishing a connection to SQL Server.

    שאלה

  • Well, there are many post about this issues but mine is a bit different that I have this problem on my hosting which I can't configure their MS SQL Server. The only thing I can access is Plesk control panel. I have uploaded my mdf file in httpdocs/App_Data, while I establishing the connection it say..

    Server Error in '/' Application.

    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
    שבת 25 ספטמבר 2010 12:42

תשובות

  • Hi,

    Could you please elaborate a bit on your scenario and post the connection string? Which version and edition of SQL Server do you have on the host server? This issue is usually caused by incorrect SQL Server instance name or SQL Server instance doesn’t enable remote connections settings.

    We need to:

    1) Make sure the connection string is valid. Check if the SQL Server instance is running and its instance name is correct.

    2) Make sure the SQL Server instance allows remote connections.

    From your description, you want to connect to a database in the App_Data folder, right? Does your connection string look like the following?

    Data Source=.\SQLEXPRESS;Integrated Security=true; AttachDbFilename=|DataDirectory|\database.mdf;User Instance=true;

    If so, a SQL Server Express instance is required on the host server because user instance is a feature of SQL Server Express Edition. This feature is not supported by other editions of SQL Server (such as Developer or Enterprise).

    If there is no SQL Server Express on the host server, we can attach the database using SQL Server Management Studio and modify the connection string as follows:

    Data Source=.;Initial Catalog=DataBaseName; Integrated Security=SSIP;

    References:

    How to configure SQL Server 2005 to allow remote connections
    http://support.microsoft.com/kb/914277

    Working with User Instances
    http://msdn2.microsoft.com/en-us/library/ms254504.aspx

    Connection strings for SQL Server 2008
    http://www.connectionstrings.com/sql-server-2008


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • סומן כתשובה על-ידי KJian_ יום שני 04 אוקטובר 2010 08:57
    יום שני 27 ספטמבר 2010 05:50