string from MySettings. All is well. This thing works in .NET just dandy.
If I reference this dataset from another project, and load that project
under IIS6/ASP/2003 using COM, it fails with the folowing error on the
FIRST request only:
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. at System.Data.SqlClient.SqlInternalConnection.OnErro r(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndW arning(TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadSni Error(TdsParserStateObject stateObj, UInt32 error)
at System.Data.SqlClient.TdsParserStateObject.ReadSni (DbAsyncResult asyncResult, TdsParserStateObject stateObj)
at System.Data.SqlClient.TdsParserStateObject.ReadPac ket(Int32 bytesExpected)
at System.Data.SqlClient.TdsParser.ConsumePreLoginHan dshake(Boolean encrypt, Boolean trustServerCert, Boolean& marsCapable)
at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)
at System.Data.SqlClient.SqlInternalConnectionTds.Ope nLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlInternalConnectionTds..ct or(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
at System.Data.SqlClient.SqlConnectionFactory.CreateC onnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionFactory.Creat ePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
at System.Data.ProviderBase.DbConnectionPool.CreateOb ject(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.UserCrea teRequest(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionPool.GetConne ction(DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.FillInternal(Data Set 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 SRE.MySummitTableAdapters.UsersTableAdapter.GetUse rById(Guid Id)
at SRE.MembershipProviders.HPMembershipProvider.GetUs er(String username, Boolean userIsOnline)
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.
All subsequent request to this dataset works just fine, so the sql
server IS there, and connecting just dandy.
In this instance above, all the data is doing is returning a single row
using a custom query on the table adapter. The part that throw an
exception the first time is this sequence:
Dim usersAdapter As New MyStuffTableAdapters.UsersTableAdapter
Dim users As MyStuff.UsersDataTable = usersAdapter.GetUserById(userId)
Even if I set the connection manually:
Dim usersAdapter As New MySummitTableAdapters.UsersTableAdapter
usersAdapter.Connection = New Data.SqlClient.SqlConnection(ConfigurationManager. ConnectionStrings("MyStuff").ConnectionString)
Dim users As MySummit.UsersDataTable = usersAdapter.GetUserById(userId)
it still throws the above timeout error on the first request only.
To make matters ever more strange:
Dim usersAdapter As New MyStuffTableAdapters.UsersTableAdapter
Debug.WriteLine(usersAdapter.Connection.Connection String)
Dim users As MyStuff.UsersDataTable = usersAdapter.GetUserById(userId)
The second line there prints the correct connection string, the one used
everywhere else... the same one that works for all request but the
first... so the value IS getting loaded... Of course, as soon as we call
the GetUserById method, we get the connection timeout above.. on the
first request.
Just to reinforce matters, on the first request after unloading all
sites fails with the connection timeout errors above, but an SQL
Profiler trace shows not connection attempt is made at all. For the
second and subsqeuent requests, the dataset queries work just fine, and
the SQL profile trace shows their activity.
At this point, I'm stumped. I don't know what is going on, or how to
prevent the data from crapping out on the first request.
Any ideas?
-=Chris