2
Answers

IIs Server hosting and ms access

I have developed web application using Asp.net and Ms access database while developing in visual studio 2020 it working fine
 
once after hosting in IIS server i am getting below-mentioned error some time
 
still its working sometime client page client they can use all the functionality which not use database
 
once I start the IIS Web server they can able to access all the functionality
 
IIS version 7.0
.net version 4.5
Ms access 2007
 
Message: Unspecified error
StackTrace:    at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)
   at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
   at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
   at System.Data.ProviderBase.DbConnectionInternal.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.OleDb.OleDbConnection.Open()
   at ncs2.dbcon.constate() in ....\leave_admin.aspx.cs:line 28
Source: Microsoft Office Access Database Engine
TargetSite: Void .ctor(System.Data.OleDb.OleDbConnectionString, System.Data.OleDb.OleDbConnection)

Answers (2)

0
Photo of Jerald Jayaraj D
1.2k 474 31.7k 4y
still having issue
current is state is closed error is coming while hosting in server
i have attached below code
 
  public static class dbcon
    {
        public static string connstring = ConfigurationManager.ConnectionStrings["dbcon"].ConnectionString;
        public static OleDbConnection con = new OleDbConnection();       
        public static void constate()
        {
            try
            {               
               con = new OleDbConnection(connstring);           
                   
                if (con.State != ConnectionState.Open)
                {
                    con.Open();
                }
                else if(con.State==ConnectionState.Closed)
               {
                                                   con.Open();
                }
            }
            catch (Exception ex)
            {
                Logfile.LogError(ex);

               string conerror= con.State.ToString();
               Logfile.Errorcon(conerror);
            }
        }
0
Photo of Sachin Singh
NA 55.8k 88.6k 4y

Go to IIS -> select your application pool -> Advanced Setting -> Process Model ->Identity=ApplicationPoolIdentity

Go to IIS -> select your application pool -> Advanced Setting -> Load User Profile = False

or
Put the impersonate=false in web.config file, if you don't want impersonation.