Import Excel Files in to .net is not working after certain period in Production
<p>I have been developed code to import excel sheet data in to grid, using c#.
It's working fine in Local , when it comes to production, after certain period of time it's giving an error saying <code>Unspecified error</code>. If I reset the IIS server, it gets resolved. Can any one suggest permanent solution for the same?</p>

<p>Sample code to open Excel:</p>

<pre><code>fileName = Path.GetFileName(fuExcel.PostedFile.FileName);
                    string fileExtension = Path.GetExtension(fuExcel.PostedFile.FileName);
                    string fileLocation = Server.MapPath("~/App_Data/" + fileName);
                    fuExcel.SaveAs(fileLocation);
                    string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= '" + fileLocation + "';Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
                    DataTable dtFromExcel = new DataTable();
                    DataTable dtBarcodeDetails = new DataTable();
                    string Sheet = System.Configuration.ConfigurationManager.AppSettings["SheetName"].ToString();
                    using (OleDbConnection excelConnection = new OleDbConnection(connectionString))
                    {   
                        OleDbCommand cmd = new OleDbCommand("Select * from [" + Sheet + "$]", excelConnection);
                        excelConnection.Open();
                        OleDbDataReader dReader;
                        dReader = cmd.ExecuteReader();
                        dtFromExcel.Load(dReader);
                        excelConnection.Close();
                    }
</code></pre>

<p>Config code:</p>

<pre><code>    &lt;system.web&gt;
      &lt;authorization&gt;
        &lt;allow users="*" /&gt;
      &lt;/authorization&gt;
        &lt;identity impersonate="false"/&gt;
&lt;httpRuntime maxRequestLength="1048576" executionTimeout="43200"/&gt;
    &lt;/system.web&gt;
</code></pre>
