locked
ASP.net, SqlExcception 0x80131904. Website can't connect to SQL Server, error 40 RRS feed

  • Question

  • So I'm getting an error with my company's ASP.net website (built on an old DotNetNuke framework) today that says:

    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) 

    And then lists this stack:

    [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.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +428
    System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +65
    System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +117
    System.Data.SqlClient.SqlConnection.Open() +122
    Microsoft.ApplicationBlocks.Data.SqlHelperParameterCache.DiscoverSpParameterSet(SqlConnection connection, String spName, Boolean includeReturnValueParameter, Object[] parameterValues) +233
    Microsoft.ApplicationBlocks.Data.SqlHelperParameterCache.GetSpParameterSetInternal(SqlConnection connection, String spName, Boolean includeReturnValueParameter) +343
    Microsoft.ApplicationBlocks.Data.SqlHelperParameterCache.GetSpParameterSet(String connectionString, String spName, Boolean includeReturnValueParameter) +175
    Microsoft.ApplicationBlocks.Data.SqlHelperParameterCache.GetSpParameterSet(String connectionString, String spName) +45
    Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteReader(String connectionString, String spName, Object[] parameterValues) +207
    DotNetNuke.Services.Log.EventLog.DBLoggingProvider.Data.SqlDataProvider.GetLogTypeConfigInfo() +71
    DotNetNuke.Services.Log.EventLog.DBLoggingProvider.DBLoggingProvider.GetLogTypeConfigInfo() +101
    DotNetNuke.Services.Log.EventLog.DBLoggingProvider.DBLoggingProvider.GetLogTypeConfigInfoByKey(String LogTypeKey, String LogTypePortalID) +65
    DotNetNuke.Services.Log.EventLog.DBLoggingProvider.DBLoggingProvider.AddLog(LogInfo objLogInfo) +75
    DotNetNuke.Services.Log.EventLog.LogController.AddLog(LogInfo objLogInfo) +175
    I had to take the site down recently, which I did my simply moving the files to another section of the hard drive (which I've done multiple times with no issues). When I moved them back, I got this. It's connecting back to a separate sql server we have, but there's a block somewhere in the connection. Both machines are able to ping each other, so I'm guessing it's something on the sql server level? We've changed nothing recently, and I checked the .config files of the ASP.net site, and they look good. The stack is very vague to me, so I don't have the first clue of where to look for my error. Thoughts?

    • Moved by Youjun Tang Wednesday, September 30, 2015 2:37 AM
    Saturday, September 26, 2015 12:19 AM

Answers

All replies

  • For questions about ASP.Net, please post on forums.asp.net.
    • Proposed as answer by Youjun Tang Wednesday, September 30, 2015 2:37 AM
    • Marked as answer by Just Karl Friday, October 23, 2015 10:51 PM
    Saturday, September 26, 2015 12:57 AM
  • When I moved them back, I got this. It's connecting back to a separate sql server we have, but there's a block somewhere in the connection. Both machines are able to ping each other, so I'm guessing it's something on the sql server level?

    It's possible that SQL Server is not accepting remote connections anymore. You can check that in the SQL Server's Management software, which the error is telling you the remote connection on Named Pipe is not working.  It all works the same for Configuration for Express and Server versions.

    http://www.linglom.com/it-support/enable-remote-connection-on-sql-server-2012-express/

    Saturday, September 26, 2015 2:14 AM
  • I'm able to use SSMS to remote into the necessary SQL server just fine, unfortunately. TCP/IP is enabled too. Think it's some problem with IIS? That wouldn't be blocking a SQL connection, would it?
    Sunday, September 27, 2015 12:44 AM
  • I'm able to use SSMS to remote into the necessary SQL server just fine, unfortunately. TCP/IP is enabled too. Think it's some problem with IIS? That wouldn't be blocking a SQL connection, would it?

    (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    Named Pipes and TCP/IP are two different communication protocols. Named Pipes is inter-process communications on the same local machine between processes while TCP/IP is communications between machines on a network, like the LAN (Local Area Network) or WAN (Wide Area Network/Internet).

    http://whatis.techtarget.com/definition/named-pipe

    If IIS and MS SQL Server are on the same machine, then I would say that Named Pipes is being used between the two processes.    

    Sunday, September 27, 2015 3:11 AM