Setting ReadTimeout in PgSqlLargeObject throwing exception
Posted: Mon 23 Apr 2012 16:00
I've got the following code in a class in my application:
This throws a "System.InvalidOperationException: Timeouts are not supported on this stream" exception on the lo.ReadTimeout = 0 line.
We are trying to keep the Large Object table operation from timing out as this seems to create the invalid connections we have been discussing in my other thread called "What is the cause of the Stream Already Closed" message?
It appears that the ReadTimeout and WriteTimeout properties mentioned in the documentation do not work and have nothing to do with setting the timeout used internally by any commands involved in retrieving data from or writing data to the large objects table. What is the correct way to keep large object operations from timing out?
Tony
Code: Select all
public static int PutImageBytes( CarSystemEntities context, byte[] image ) {
PgSqlConnection connection = ( (EntityConnection) context.Connection ).StoreConnection as PgSqlConnection;
try {
if ( connection.State != ConnectionState.Open ) {
connection.Open();
}
PgSqlLargeObject lo = new PgSqlLargeObject( connection );
lo.ReadTimeout = 0;
lo.WriteTimeout = 0;
lo.Create();
lo.Open();
lo.Write( image, 0, image.Length );
lo.Close();
return lo.Oid;
} catch ( Exception ex ) {
throw new DataAccessException( DataAccessOperations.PutImageBytes, FailureReason.DatabaseError, ex );
}
}
We are trying to keep the Large Object table operation from timing out as this seems to create the invalid connections we have been discussing in my other thread called "What is the cause of the Stream Already Closed" message?
It appears that the ReadTimeout and WriteTimeout properties mentioned in the documentation do not work and have nothing to do with setting the timeout used internally by any commands involved in retrieving data from or writing data to the large objects table. What is the correct way to keep large object operations from timing out?
Tony