Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
 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:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

web.config
Posted
Comments
PSK_ 9-Jun-10 7:27am    
It seems that your connection string is not correct, can you check your host name and port number are correct.

Check you have SQL server installed, and you can access it.
If you do, and you can, then put a try...catch block around the connection code, and examine the exception and inner exception. Check names.
Report findings by editing your original question, and add a comment to this answer, so I am alerted you have more info.
 
Share this answer
 
XML
<?xml version="1.0"?>
<configuration>
 <configSections>
 <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
 ... <!-- код студии -->
</sectionGroup>
 </sectionGroup>
 </configSections>
 <appSettings/>
 <connectionStrings>
 <add name="SqlServices" connectionString="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=aspnetdb;" />
 </connectionStrings>
 <system.web>
 <authentication mode="Forms">
 <forms loginUrl="login.aspx"
 name=".ASPXFORMSAUTH" />
 </authentication>
 <roleManager enabled="true" />
 <compilation debug="true">
...
 </compilation>
 <pages>
 <controls>
 ... </pages>
 <httpHandlers>
...
 <httpModules>
 ... </httpModules>
 <membership defaultProvider="SqlProvider"
 userIsOnlineTimeWindow="15">
 <providers>
 <add
 name="SqlProvider"
 type="System.Web.Security.SqlMembershipProvider"
 connectionStringName="SqlServices"
 applicationName="MyApplication"
 enablePasswordRetrieval="false"
 enablePasswordReset="true"
 requiresQuestionAndAnswer="true"
 requiresUniqueEmail="false"
 passwordFormat="Hashed"
 maxInvalidPasswordAttempts="5"
 passwordAttemptWindow="10" />
 </providers>
 </membership>

 </system.web>
 <system.codedom>
 <compilers>
 <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
 ... </compiler>
 </compilers>
 </system.codedom>
 <system.webServer>
 <validation validateIntegratedModeConfiguration="false"/>
 <modules>
 <remove name="ScriptModule"/>
 <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
 </modules>
 <handlers>
 ...
 </handlers>
 </system.webServer>
 <runtime>
 ...
 </runtime>
</configuration>
 
Share this answer
 
The above listed file web.konfig
Perhaps it is wrong written.
The database was created through the ASP.NET konfiguration
The database is in the folder App_Data.
All in principle by default.
When a component ID login and password, this error
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900