AboutSQL Server, Analytics, .Net, Machine Learning, R, Python Archives
About Me
Mitch Wheat has been working as a professional programmer since 1984, graduating with a honours degree in Mathematics from Warwick University, UK in 1986. He moved to Perth in 1995, having worked in software houses in London and Rotterdam. He has worked in the areas of mining, electronics, research, defence, financial, GIS, telecommunications, engineering, and information management. Mitch has worked mainly with Microsoft technologies (since Windows version 3.0) but has also used UNIX. He holds the following Microsoft certifications: MCPD (Web and Windows) using C# and SQL Server MCITP (Admin and Developer). His preferred development environment is C#, .Net Framework and SQL Server. Mitch has worked as an independent consultant for the last 10 years, and is currently involved with helping teams improve their Software Development Life Cycle. His areas of special interest lie in performance tuning |
Saturday, July 08, 2006An error has occurred…
I recently got bitten by a rather annoying and hard to track down error. I was in the process of creating a fairly simple ASP.NET 2.0 application which accesses a SQL Server 2005 database. It worked at home but not in the office…
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) After doing a few Google searches, it turns out this can be caused by lots of things, and there are quite a few similar error messages for many different reasons. The most often cited one is due to SQL Server 2005 not accepting remote connections by default (which personally I think is ridiculous, it’s a server right, the whole reason for having servers is to allow access by remote clients! But I digress..) So I fired up the Surface Area Tool 2005 and checked that remote connections were allowed. No problems there. Another oft cited reason for this error is that a Specific Protocol is not enabled. So I opened up SQL Server Configuration Manager and checked the Client Protocols. All fine. Of course! It’s probably the firewall. Checked it and in desperation temporarily turned it off. Still no good. Checked the connection string worked in isolation. Once again nothing wrong there. After a great deal of hair-pulling and searching I finally found the problem. The ASP.NET role provider was trying to access the role table via a connection string named “LocalSQLServer” defined in the machine.config, and this was pointing to “.\SQLEXPRESS” which was not installed! The simple fix is to override in your web.config: <connectionStrings> <remove name="LocalSqlServer" /> <add name="LocalSqlServer" connectionString="Data Source={local};Initial Catalog=myDB;Trusted_Connection=True" providerName="System.Data.SqlClient"/> </connectionStrings> I had installed several of the ASP.NET starter kits and doing so had updated the machine.config. The reason it worked at home was because an application had installed SQLExpress without me realising! These links helped me track down the problem: http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx#453222 http://www.aquesthosting.com/HowTo/Sql2005/SQLError26.aspx |
ContactMSN, Email: mitch døt wheat at gmail.com LinksFavorites
Blogs |