2

i am porting a web application to aws. there is an aspx page that collates info from about 15 or 20 different tables data tables from 3 different databases. it is running fine on godaddy shared hosting and also on my dev servers but when i put it on a micro instance ec2 on aws (not sure if that has anything to do with the problem just trying to give as much info as possible) i am getting random errors. i works sometimes but quite often i am getting the following error

Internal connection fatal error at

System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler,
SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject
stateObj) 
at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() 
at System.Data.SqlClient.SqlDataReader.get_MetaData() 
at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior  runBehavior, String resetOptionsString) 
at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) 
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)  
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) 
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) 
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) 
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) 
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) 
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) 
at UtilitiesLib.csharp.CSharpSqlServer.executeQuery(String sqlstring) in X:\code\UtilitiesLibCSharp\CSharpSqlServer.cs:line 87 at UtilitiesLib.data.Database.executeQuery(DataClass obj, String sqlstring) 
in X:\code\UtilitiesLibSL\data\Database.cs:line 67 
at UtilitiesLib.data.DataClass.loadSQLObject(Database db, DataClass obj, Int32[] cols, String[] signs, String[] vals, String[] ops) in X:\code\UtilitiesLibSL\data\DataClass.cs:line 253 
at UtilitiesLib.data.reading.TestBlockItemMathProblem..ctor(Database db, Int32 blockid, Int32 teacherid) in X:\code\UtilitiesLibSL\data\reading\TestBlockItemMathProblem.cs:line 30 
at UtilitiesLib.transport.reading.readingTCPCommHandlerClient.getTestBlockItem(Int32 type, Database db, Int32 blockid, Int32 teacherid) in X:\code\UtilitiesLibSL\transport\reading\readingTCPCommHandlerClient.cs:line 325 
at reading.test.Page_Load(Object sender, EventArgs e) in X:\code\reading\test.aspx.cs:line 157

sometimes i get a different error that says something to the effect that the connection is already closed.

this is super weird because i have no problem with the site on the shared hosting or on my dev server. the aws machine is running windows 2008 server and iis 7.5 and sql server express 2008 r2. there are other pages in the site that use data tables just fine and never have this error but they are using less less data tables. anyone have any idea what could be causing this?

Sujay
  • 6,753
  • 2
  • 30
  • 49

1 Answers1

0

I think you are hitting the micro instance's 613MB RAM limit. It's probably not enough for Windows Server, IIS, and SQL Server together. A couple of things you might also try: disable connection pooling in the connection string; also, make sure you immediately dispose your connection as soon as the command completes (use using blocks).

udog
  • 1,490
  • 2
  • 17
  • 30