I have a VB application using .NET 3.5 that allows users to upload an Excel file. The application then reads from this file and inserts its contents into a database.
The problem is that the read seems to fail in our PRODUCTION environment only. Here's the error produced:
ErrorMessage: System.Data.OleDb.OleDbException: Unspecified error
at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.OleDb.OleDbConnection.Open()
at uploader.ReadExcel(String sFile) in E:\path_to_application\uploader.aspx.vb:line 85
Here's lines 84 and 85 of the ReadExcel function in uploader.aspx.vb:
oConn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + sFile + ";Extended Properties=""Excel 8.0;HDR=Yes;IMEX=1"";")
oConn.Open()
oConn.Open() fails ONLY in production, the exact same codebase on my local machine works as expected.
- The file does indeed exist at the path specified in the
sFile
variable - This question suggested it might be a problem with exceeding the concurrent connection limit, but even after restarting the application with IIS the problem persisted
- It does not seem to be a permissions issue, all user groups on the server have at least Read & Execute on the uploaded files
What other differences could I look for between the production and local environments? What else could cause opening this OleDB connection to fail like this?
UPDATE: A workaround seems to be to recycle the application pool in IIS. Any ideas on what it is that's being reset that fixes it?