"An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
The webpart requires the sqlserver 2005 for its working. The webpartmanager is looking for SQL Express 2005 which, by default, is the personalization provider. Now if you remove the SQL server Express 2005 and instead install SQL Server 2005 then vs2005 is not able to find out the location of sql server and throws an error regarding SQL server 2005.
The following steps will help in removing this error
1. Open the visual studio command prompt and type aspnet_regsql.exe. This will open up a wizard to set the SQL server settings
2. Click next next till you click finish in the wizard. This will create a default database aspnetdb in the SQL Server 2005
3.Open the SQL server management and check the name of the server: In my case it is INHCJITBZR1SL. This is actually same as the computername.
4. Open the web.config file. Add the following lines.
<connectionStrings>
<remove name="LocalSqlServer" />
<add name="LocalSqlServer" connectionString="SERVER=INHCJTBZR1SL;Integrated Security=true;Initial Catalog=aspnetdb" providerName="System.Data.SqlClient"/>
</connectionStrings>
<remove> will remove the old settings about the sql server.
Basically you are trying to tell .NET where to find teh SQL server using the connection string.
Compile the code and run it again. It should work. If still the database related error is coming it means that the connection string is not correct.
Some of the other links which talk about the same issue are:
http://blogs.neudesic.com/blogs/pete_orologas/archive/2006/06/14/162.aspx
http://daron.yondem.com/CommentView.aspx?guid=cb37f9ff-81d3-4b9c-ab97-18e9eddd9a27
No comments:
Post a Comment