Search code examples
asp.netasp.net-mvcasp.net-membership

AspNet MVC template issue


I'm having some trouble with the asp.net "register/login system" that comes ready with the AspNet MVC template. It worked great for me up until recently that I started receiving the following error:

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)

I tried running old versions of the code that used to work and they failed as well, I don't know what could have caused it.

Thanks ahead! Eran


Solution

  • Check the SQL Server service account

    • If you are not using a domain account as a service account (for example if you are using NETWORK SERVICE)

      you may want to switch this first before proceeding

    • If you are using a named SQL Server instance

      make sure you are using that instance name in your connection strings in your ASweb P.NET application

    • Usually the format needed to specify the database server is machinename\instancename

    • Check your connection string as well

    • Check that you have connectivity to the SQL Server

    . Note what you are using to connect: machine name, domain name or IP address? Use this when checking connectivity. For example if you are using myserver

    Start > Run > cmd
    
    netstat -ano| findstr 1433
    
    telnet myserver 1433
    
    ping -a myserver
    

    more info at: http://www.sqlmusings.com/2009/03/11/resolving-a-network-related-or-instance-specific-error-occurred-while-establishing-a-connection-to-sql-server/