title: Unable to read excel file on IIS
body: <p>I am trying to read Excel sheet in my asp.net web-site.
  File is uploaded by user and then I read it and show result in Grid View. 
  Every things works fine when I run it in Visual Studio Environment. 
  But when I tried same code on IIS it giving an Exception <code>Unspecified Error</code>. 
  I am using following code:</p>
  
  <pre><code>string excelConnection = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+Server.MapPath("~/doc/")+ filepath+";Extended Properties="+ "\"" + "Excel 12.0;HDR=YES;" + "\"";
          string query = "select * from [Sheet1$]";
          OleDbConnection con = new OleDbConnection(connection);
          con.Open();               // Exceptionoccurs here
          OleDbCommand cmd = new OleDbCommand(query, con);
          cmd.CommandType = CommandType.Text;
          OleDbDataReader dr = cmd.ExecuteReader();
          DataTable dt = new DataTable();
          dt.Load(dr);
          testGrid.DataSource = dt;
          testGrid.DataBind();
  </code></pre>
  
  <p>Exception Stack Trace:</p>
  
  <pre><code>[OleDbException (0x80004005): Unspecified error]
     System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +351
     System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +86
     System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup) +31
     System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +76
     System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126
     System.Data.OleDb.OleDbConnection.Open() +43
     DataBaseSolution.DbSolution.select(String connection, String providername, String query) in F:\vs backup\DataBaseSolution\DataBaseSolution\DbSolution.cs:63
     _Default.insertDb(String filepath) in c:\inetpub\wwwroot\test\Default.aspx.cs:82
     _Default.checkButton_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\test\Default.aspx.cs:39
     System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
     System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
     System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
     System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
     System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
     System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
  </code></pre>
  
  <p>Please suggest me any update in code or any other method by which I can do this task.</p>
  
  <p><strong>Edited: Provided Stack Trace and marked line with a comment where Exception Occurs</strong></p>