A weired error about HTTP 500 !

Alick Wang 266 Reputation points
2024-04-10T07:22:48.6266667+00:00

I created a web user asp.net 8.0 mvc without ef.

When I modify the stucture of oracle datebase table ,such as add a field ,then the web related to the table report a error about HTTP 500 . But after I restart the iis,it works well without doing anything else!

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,274 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 58,936 Reputation points
    2024-04-10T17:10:40.7133333+00:00

    As we can not see your code, we have no idea why it behaves this way. I’d assume you have some init code that needs to run on a schema change.

    0 comments No comments

  2. Alick Wang 266 Reputation points
    2024-04-11T08:51:09.7866667+00:00

    .net 8.0 with Dependency Injection

    In Program.cs

    builder.Services.AddScoped<DAL.Account.IAccount,DAL.Account.Account>();

    In Account.cs

    public class Account : IAccount

    {

    private readonly IOptions<DAL._DBConnStr> _dbconnStr;

    public Account(IOptions<DAL._DBConnStr> dbconnStr)

    {

    _dbconnStr = dbconnStr;

    }

    public DataTable GetRoles()

    {

    using (OracleConnection conn = new OracleConnection(_dbconnStr.Value.myConnectionString))

    {

    DataTable dt = new DataTable();

    OracleCommand selectCmd = new OracleCommand("select * from roles order by sortindex", conn);

    OracleDataAdapter da = new OracleDataAdapter();

    da.SelectCommand = selectCmd;

    da.Fill(dt);

    return dt;

    }

    }

    In AccountController

    IAccount AccountDA;

    public AccountController(IAccount accountDA)

    {

    AccountDA = accountDA;

    }

    public IActionResult Login(string ua)

    {

    DataTable dt = AccountDA.GetUserAccountByUser(ua);

    }


  3. Alick Wang 266 Reputation points
    2024-05-17T13:56:46.7766667+00:00

    to:MotoX80

    In the windows logs->applications

    ---> Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-00942:

    at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)

    at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteReader(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, OracleDataReaderImpl& rdrImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[] scnForExecution, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, Int64& internalInitialLOBFS, Int64 internalInitialJSONFS, OracleException& exceptionForArrayBindDML, OracleConnection connection, IEnumerable`1 adrianParsedStmt, Boolean isDescribeOnly, Boolean isFromEF)

    at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior)

    at Oracle.ManagedDataAccess.Client.OracleDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)

    at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)