User-1507580228 posted
Hello,
What is the right configration for the ConnectionString in the web config file.
I have one lie this :
<connectionStrings>
<add
name="RegistrationConnectionString"
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|Registration.mdf;User Instance=true"
providerName="System.Data.SqlClient"
/>
</connectionStrings>
Which works fine in my Visul Studio 2017.But when I upload it to the Domain It comes up with this Error When the web page try to access it
(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)
Source Error:
Line 17: {
Line 18: SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString);
Line 19: conn.Open();
Line 20: string checkuser = "select count (*) from UserData where UserName='" + TextBoxUserName.Text + "'";
Line 21: SqlCommand com = new SqlCommand(checkuser, conn);
Source File: g:\pleskvhosts\mytrips100.com\httpdocs\default.aspx.cs Line: 19
)
Can anybody help??
Thank you