Error report - hard to diagnose because I can't get it to fail

I’ve received 5 error reports from a site overnight.

Exception information:
    Exception type: System.Data.SqlClient.SqlException
    Exception message: 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)

It would seem that it’s an issue with the server but it was reported to always occur at DomainModel.Services.ConfigService.get_companyName() which occurs when my config service asks the database for the company name using ByName(“Company_Name”)

private static Func<mvCmsContext, string, Configuration> _byName =
	CompiledQuery.Compile((mvCmsContext context, string configName) =>
		(from c in context.Configs
		 where c.configName == configName
		 select c).SingleOrDefault());
static public Configuration ByName(string configName)
{
	var result = (Configuration)HttpContext.Current.Cache.Get(configName);
	if (result == null)
	{
		using (var context = new mvCmsContext())
		{
			result = _byName(context, configName);
			HttpContext.Current.Cache.Insert(configName, result);
		}
	}
	return result;
}
Thread information:
    Thread ID: 13
    Thread account name: NT AUTHORITY\\NETWORK SERVICE
    Is impersonating: False
    Stack trace:    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at System.Data.Linq.SqlClient.SqlConnectionManager.UseConnection(IConnectionUser user)
   at System.Data.Linq.SqlClient.SqlProvider.get_IsSqlCe()
   at System.Data.Linq.SqlClient.SqlProvider.InitializeProviderMode()
   at System.Data.Linq.SqlClient.SqlProvider.System.Data.Linq.Provider.IProvider.Compile(Expression query)
   at System.Data.Linq.CompiledQuery.ExecuteQuery(DataContext context, Object[] args)
   at System.Data.Linq.CompiledQuery.Invoke[TArg0,TArg1,TResult](TArg0 arg0, TArg1 arg1)
   at DomainModel.Concrete.ConfigRepository.ByName(String configName)
   at DomainModel.Services.ConfigService.get_companyName()
   at ASP.views_shared_site_master.__Render__control1(HtmlTextWriter __w, Control parameterContainer)
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children)
   at System.Web.UI.Page.Render(HtmlTextWriter writer)
   at System.Web.Mvc.ViewPage.Render(HtmlTextWriter writer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Is it just a server glitch or am I going to have to do some debugging today? I can’t get it to fail no matter what I try.

edit - I just noticed one of the error reports was from a separate site. The first 4 were a local IP (ugh, probably the site owner) on one site between 11:00-11:04pm while the other was a chinese IP on my site at 11:07.

I would suspect server glitch… Have you looked into what was sql server doing at that time.
backups?!

It’s on shared hosting. I’ll ask. Thanks for the tip. I haven’t had an error report for months and the even then it was a form Validation error of someone trying to spam a contact page with html links.

I figure it failed on get_CompanyName because that’s the first thing that happens on the page. It gets it for the <title>

It looks like the error is with the database server. I got a few more errors just now and I can’t connect to the database server with MSSQL Server Management Studio either.

Reports from the host show DDoS attacks at the precise times I received the error reports.