We have disabled the firewall then also it is giving the same error On Wed, Dec 24, 2008 at 12:53 AM, The_Fruitman <[email protected]>wrote:
> > As the error message states: The server was not found or was not > accessible. > > Check your connection string data source property. > > www.connectionstrings.com > > Verify that you are not blocked by a firewall. > > > > On Dec 23, 8:26 am, "hirendra singh" <[email protected]> wrote: > > * hi > > > > SqlConnection con = new SqlConnection(cStr); > > > > con.Open(); > > > > code give an error any on give bast solution this code > > its working fine in local mssql. > > > > its not working online working in server mssql. > > please let me knw wer i'm wrong > > here is my code > > > > Hirendra pratap singh > > > > Niit student > > > > thanks > > 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: Named Pipes Provider, error: 40 - > > Could not open a connection to SQL Server) > > > > 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: Named Pipes Provider, error: 40 - Could not open > a > > connection to SQL Server) > > > > Source Error: > > > > Line 33: > > Line 34: con.ConnectionString = conn;Line 35: > > con.Open();Line 36: int i; > > Line 37: i = 0; > > > > using System; > > > > using System.Data; > > > > using System.Configuration; > > > > using System.Collections; > > > > using System.Web; > > > > using System.Web.Security; > > > > using System.Web.UI; > > > > using System.Web.UI.WebControls; > > > > using System.Web.UI.WebControls.WebParts; > > > > using System.Web.UI.HtmlControls; > > > > using System.Net.Mail; > > > > using System.Data.SqlClient; > > > > public partial class Signup : System.Web.UI.Page > > > > { > > > > SqlConnection con = new SqlConnection(); > > > > string conn = ConfigurationManager.ConnectionStrings["appConnection" > > ].ConnectionString; > > > > protected void Page_Load(object sender, EventArgs e) > > > > { > > > > -----some code here > > > > } > > > > protected void Button3_Click1(object sender, EventArgs e) > > > > { > > > > con.ConnectionString = conn; > > > > con.Open(); > > > > int i; > > > > i = 0; > > > > SqlCommand cmd2 = new SqlCommand("select [username] from userinfo2 where" > + > > "(([usernam...@username))", con); > > > > cmd2.Parameters.Add("@username", SqlDbType.VarChar, 50); > > > > cmd2.Parameters["@username"].Value = txtusername.Text; > > > > SqlDataReader dr; > > > > dr = cmd2.ExecuteReader(CommandBehavior.CloseConnection); > > > > while (dr.Read()) > > > > { > > > > i = 1; > > > > } > > > > if (i == 1) > > > > { > > > > LblUN.Visible = true; > > > > LblUN.Text = txtusername.Text + " is not available"; > > > > } > > > > else if (txtusername.Text == "") > > > > { > > > > LblUN.Visible = true; > > > > LblUN.Text = "Please enter the value"; > > > > } > > > > else > > > > { > > > > LblUN.Visible = true; > > > > LblUN.Text = txtusername.Text+" is available"; > > > > } > > > > dr.Close(); > > > > con.Close(); > > > > } > > > > * ** *+++++++++++++++++++++++++++* > > > > <?xml version="1.0"?> > > > > <configuration> > > > > <configSections> > > > > <sectionGroup name="system.web.extensions" > > type="System.Web.Configuration.SystemWebExtensionsSectionGroup, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35"> > > > > <sectionGroup name="scripting" > > type="System.Web.Configuration.ScriptingSectionGroup, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35"> > > > > <section name="scriptResourceHandler" > > type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" requirePermission="false" > allowDefinition=" > > MachineToApplication" /> > > > > <sectionGroup name="webServices" > > type="System.Web.Configuration.ScriptingWebServicesSectionGroup, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35"> > > > > <section name="jsonSerialization" > > type="System.Web.Configuration.ScriptingJsonSerializationSection, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" requirePermission="false" > allowDefinition=" > > Everywhere" /> > > > > <section name="profileService" > > type="System.Web.Configuration.ScriptingProfileServiceSection, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" requirePermission="false" > allowDefinition=" > > MachineToApplication" /> > > > > <section name="authenticationService" > > type="System.Web.Configuration.ScriptingAuthenticationServiceSection, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" requirePermission="false" > allowDefinition=" > > MachineToApplication" /> > > > > </sectionGroup> > > > > </sectionGroup> > > > > </sectionGroup> > > > > </configSections> > > > > <system.web> > > > > <customErrors mode="Off" defaultRedirect="404.aspx" /> > > > > <!-- > > > > Set compilation debug="true" to insert debugging > > > > symbols into the compiled page. Because this > > > > affects performance, set this value to true only > > > > during development. > > > > --> > > > > <httpHandlers> > > > > <remove verb="*" path="*.asmx" /> > > > > <add verb="*" path="*.asmx" validate="false" > > type="System.Web.Script.Services.ScriptHandlerFactory, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" /> > > > > <add verb="*" path="*_AppService.axd" validate="false" > > type="System.Web.Script.Services.ScriptHandlerFactory, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" /> > > > > <add verb="GET,HEAD" path="ScriptResource.axd" > > type="System.Web.Handlers.ScriptResourceHandler, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" validate="false" /> > > > > <add verb="GET" path="ImageVerifier.axd" > > type="NatsNet.Web.UI.Controls.ImageVerifier, > > NatsNet.Web.UI.Controls" /> > > > > </httpHandlers> > > > > <httpModules> > > > > <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" /> > > > > </httpModules> > > > > <compilation defaultLanguage="c#" debug="true" /> > > > > <globalization culture="en-US" uiCulture="en-US" /> > > > > </system.web> > > > > <system.web.extensions> > > > > <scripting> > > > > <webServices> > > > > <!-- Uncomment this line to customize maxJsonLength and add a custom > > converter --> > > > > <!-- > > > > <jsonSerialization maxJsonLength="500"> > > > > <converters> > > > > <add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/> > > > > </converters> > > > > </jsonSerialization> > > > > --> > > > > <!-- Uncomment this line to enable the authentication service. Include > > requireSSL="true" if appropriate. --> > > > > <!-- > > > > <authenticationService enabled="true" requireSSL = "true|false"/> > > > > --> > > > > <!-- Uncomment these lines to enable the profile service. To allow > profile > > properties to be retrieved > > > > and modified in ASP.NET AJAX applications, you need to add each property > > name to the readAccessProperties and > > > > writeAccessProperties attributes. --> > > > > <!-- > > > > <profileService enabled="true" > > > > readAccessProperties="propertyname1,propertyname2" > > > > writeAccessProperties="propertyname1,propertyname2" /> > > > > --> > > > > </webServices> > > > > <!-- > > > > <scriptResourceHandler enableCompression="true" enableCaching="true" /> > > > > --> > > > > </scripting> > > > > </system.web.extensions> > > > > <system.webServer> > > > > <validation validateIntegratedModeConfiguration="false" /> > > > > <modules> > > > > <add name="ScriptModule" preCondition="integratedMode" > > type="System.Web.Handlers.ScriptModule, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" /> > > > > </modules> > > > > <handlers> > > > > <remove name="WebServiceHandlerFactory-Integrated" /> > > > > <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition=" > > integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" /> > > > > <add name="ScriptHandlerFactoryAppServices" verb="*" > path="*_AppService.axd" > > preCondition="integratedMode" > > type="System.Web.Script.Services.ScriptHandlerFactory, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" /> > > > > <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" > > path="ScriptResource.axd" > type="System.Web.Handlers.ScriptResourceHandler, > > System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, > > PublicKeyToken=31bf3856ad364e35" /> > > > > </handlers> > > > > </system.webServer> > > > > <connectionStrings> > > > > <add name="appConnection" connectionString="data source=.;initial > > catalog=manager_vdnextw; User id=vdnextw; Password=123456" providerName=" > > System.Data.SqlClient"/> > > > > <remove name="LocalMySqlServer" /> > > > > </connectionStrings> > > > > </configuration> > > *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: Named Pipes Provider, error: 40 - > > Could not open a connection to SQL Server)* *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: Named Pipes Provider, error: 40 - Could not open > a > > connection to SQL Server) > > > > * 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: Named Pipes Provider, error: 40 - > > Could not open a connection to SQL Server) 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: Named Pipes Provider, error: 40 - Could not open > a > > connection to SQL Server) > > > > Source Error: > > > > Line 33: > > Line 34: con.ConnectionString = conn;Line 35: > > con.Open();Line 36: int i; > > Line 37: i = 0; > > > > Source File: c:\inetpub\vhosts\vdnext.com\httpdocs\Signup.aspx.cs > Line: 35 > > > > Stack Trace: > > > > [SqlException (0x80131904): 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: Named Pipes Provider, error: 40 - Could not > > open a connection to SQL Server)] > > System.Data.SqlClient.SqlInternalConnection.OnError(SqlException > > exception, Boolean breakConnection) +4844759 > > > > System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject > > stateObj) +194 > > System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, > > SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, > > Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean > > integratedSecurity, SqlConnection owningObject) +4858065 > > > System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo > > serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 > > timerExpire, SqlConnection owningObject) +90 > > System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String > > host, String newPassword, Boolean redirectedUserInstance, > > SqlConnection owningObject, SqlConnectionString connectionOptions, > > Int64 timerStart) +342 > > > System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection > > owningObject, SqlConnectionString connectionOptions, String > > newPassword, Boolean redirectedUserInstance) +221 > > > > System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity > > identity, SqlConnectionString connectionOptions, Object providerInfo, > > String newPassword, SqlConnection owningObject, Boolean > > redirectedUserInstance) +189 > > > > System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions > > options, Object poolGroupProviderInfo, DbConnectionPool pool, > > DbConnection owningConnection) +185 > > > > System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection > > owningConnection, DbConnectionPool pool, DbConnectionOptions options) > > +31 > > System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection > > owningObject) +433 > > > System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection > > owningObject) +66 > > System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection > > owningObject) +499 > > > System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection > > owningConnection) +65 > > > System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection > > outerConnection, DbConnectionFactory connectionFactory) +117 > > System.Data.SqlClient.SqlConnection.Open() +122 > > Signup.Button3_Click1(Object sender, EventArgs e) in > > c:\inetpub\vhosts\vdnext.com\httpdocs\Signup.aspx.cs:35 > > System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111 > > System.Web.UI.WebControls.Button.RaisePostBackEvent(String > > eventArgument) +110 > > > > System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String > > eventArgument) +10 > > System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler > > sourceControl, String eventArgument) +13 > > System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) > +36 > > System.Web.UI.Page.ProcessRequestMain(Boolean > > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) > > +1565 > > > > ------------------------------ > > Version Information: Microsoft .NET Framework Version:2.0.50727.3053; > > ASP.NET Version:2.0.50727.3053 * > > > > -- > > A Door knocks twice. insider asks--who is there... ans was : its > OPPOTUNITY" > > insider tels ,you are wrong becouse oppotunity never knocks twice > > रात यों कहने लगा मुझसे गगन का चाँद, > > आदमी भी क्या अनोखा जीव होता है! > > ,उलझनें अपनी बनाकर आप ही फँसता > > और फिर बेचैन हो जगता, न सोता है। >
