Click here to Skip to main content
15,878,959 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi Everybody,

The issue I am facing is: While creating oledb connection to an excel file (.xlsx), the application pool has stopped.

Issue in Detail:

Application details: .Net/C#/Visual Studio 2019/Office 365/Windows Server 2016 Datacenter/

what I did:
I am migrating my web application from .net framework 4.5 to 4.8. For this, the server has upgraded to the .net fw 4.8. Also, the web application has changed it's targetframework to 4.8. And, the updated application build has been rolled out in the server. Most of the time, the below functionality returns 'ERR_HTTP2_PROTOCOL_ERR'.

functionality:
In a module, user uploads the excel file to fetch the data into the sql server database. This functionality, first moves the user's excel file to a folder in server. From that folder, the file has been connected by the OLEDB provider "Microsoft.OLEDB.ACE.12.0". And then, the file data fetched into a datatable which will be passed to a SqlBulkCopy that targeting the table in SQL server.
This functionality is already working fine for several years in .net fw 4.5. Just changing this to 4.8 is the issue now.

Establising OLEDB connection codes:
internal static OleDbConnectionStringBuilder ConStrOledbForExcel(string oleVers,string datSourc)
{
	try
	{
		if (oleVers == "ace12")
		{
			OledbConStr.Provider = "Microsoft.ACE.OLEDB.12.0";
			OledbConStr.DataSource = datSourc;
			OledbConStr.Add("Extended Properties", "Excel 12.0 xml;HDR=YES;IMEX=1;");
		}
		else if (oleVers == "jet4")
		{
			OledbConStr.Provider = "Microsoft.Jet.OLEDB.4.0";
			OledbConStr.DataSource = datSourc;
			OledbConStr.Add("Extended Properties", "Excel 8.0;HDR=YES;");
		}
	}
	catch ( Exception ex)
	{
		......
	}
	return OledbConStr;
}
....
if (filetypext == ".xlsx")
{
	oleconstr = GlobalSessionClass.ConStrOledbForExcel("ace12", FilePath);
}
else
{
	oleconstr = GlobalSessionClass.ConStrOledbForExcel("jet4", FilePath);
}
....
OleDbConnection sSourceConnection = new OleDbConnection(oleconstr.ConnectionString);
OleDbCommand oledbcmd;
DataSet dataset1 = new DataSet();
OleDbDataAdapter adapter;


Note: The desired functionality is sometime working, sometime not working and returns the error 'ERR__HTTP2_PROTOCOL_ERR'. Please help resolve this.


Thanks.

What I have tried:

I verified that the .net fw 4.8 is installed in server.

Few findings in this issue:
The source excel file moved to server location successfully.
The whole functionality is working fine some times.
Most of the time it returns 'ERR_HTTP2_PROTOCOL_ERR'.
Event viewer shows the event id 5011 during the application pool crashes.
No more firewall blocks related to the site.
Posted
Updated 15-Sep-22 3:54am
v6
Comments
Richard Deeming 15-Sep-22 4:29am    
So there's an error that we can't see, happening in code we can't see, running on a server we can't access, and you want us to tell you how to fix it?

You're going to need to provide a lot more detail if you want anyone to be able to help you. The full details of the error that's causing the app pool to crash, the relevant parts of your code, etc.
Member 14896141 15-Sep-22 9:56am    
Sure. I have added some more details. Thought the solution could be reached logically...sorry for that. Thanks for the headsup.
Michael_Davies 15-Sep-22 9:56am    
Have you tried changing Pooling behaviour?

https://www.visualbasicplanet.info/client-development/configuring-connection-pooling-with-ole-db-connections.html
Member 14896141 15-Sep-22 9:58am    
no. will try.
Member 14896141 15-Sep-22 13:52pm    
Tried. The issue still persist.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900