Connection id "0HLF65M4A0D4I", Request id "0HLF65M4A0D4I:0000000E": An unhandled exception was thrown by the application
See original GitHub issueI downloaded the ABP version 3.7.2 and ran it for the first time without adding any entity and it worked fine as expected. However, when I added some entities, It does not start! I checked the error log and noticed the error Connection id "0HLF65M4A0D4I", Request id "0HLF65M4A0D4I:0000000E": An unhandled exception was thrown by the application
Below is the entity I added in the Bank.Core project. I created a new folder (Transactions) to match my entity name Transaction which contains foreign keys. See below.
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using Bank.Authorization.Users;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Bank.Transactions
{
[Table("Tbl_Transactions")]
public class Transaction : Entity<long>, IHasCreationTime
{
/// <summary>
/// Maximum User's account number length
/// </summary>
public const int MaxAccountNumberLength = 10;
public enum Currency
{
NGN = 566,
USD = 840,
EUR = 978
}
public DateTime CreationTime { get; set; }
public Investment Investment { get; set; }
public bool IsCompleted { get; set; }
public Loan Loan { get; set; }
public User User { get; set; }
}
}
The Loan entity is as follows
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Bank.Transactions
{
[Table("Tbl_Loans")]
public class Loan : Entity<long>, IHasCreationTime
{
[StringLength(Transaction.MaxAccountNumberLength)]
public string AccountNumber { get; set; }
public decimal? Amount { get; set; }
public DateTime CreationTime { get; set; }
public DateTime? EffectiveDate { get; set; }
public DateTime? InstallmentDate { get; set; }
public decimal? InterestRate { get; set; }
public decimal? ManagementFee { get; set; }
public DateTime? MaturityDate { get; set; }
public decimal? ProcessingFee { get; set; }
public decimal? RepaymentAmount { get; set; }
public int? Tenor { get; set; }
}
}
And the Investment Entity as follows
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Bank.Transactions
{
[Table("Tbl_Investments")]
public class Investment : Entity<long>, IHasCreationTime
{
[StringLength(Transaction.MaxAccountNumberLength)]
public string AccountNumber { get; set; }
public decimal? Amount { get; set; }
public DateTime CreationTime { get; set; }
public Transaction.Currency? Currency { get; set; }
public DateTime? EffectiveDate { get; set; }
public decimal? ExpectedInterestAmount { get; set; }
public decimal? InterestRate { get; set; }
public decimal? MaturityAmount { get; set; }
public DateTime? MaturityDate { get; set; }
public int? Tenor { get; set; }
}
}
And here is my Database Context class
using Abp.Zero.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
using Bank.Authorization.Roles;
using Bank.Authorization.Users;
using Bank.MultiTenancy;
namespace Bank.EntityFrameworkCore
{
public class BankDbContext : AbpZeroDbContext<Tenant, Role, User, BankDbContext>
{
/* Define a DbSet for each entity of the application */
public DbSet<Transactions.Transaction> Transactions { get; set; }
public BankDbContext(DbContextOptions<BankDbContext> options)
: base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ChangeAbpTablePrefix<Tenant, Role, User>("Tbl_");
}
}
}
When I add migration and update my database, I get the error Connection id "0HLF65M4A0D4I", Request id "0HLF65M4A0D4I:0000000E": An unhandled exception was thrown by the application
however the Angular project still works fine after runing the refresh.bat
file.
The error message is not very useful and I’ve done a lot of googling but couldn’t make any headway.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top GitHub Comments
It worked after I commented out the line
options.IndexStream = () => Assembly.GetExecutingAssembly().GetManifestResourceStream("Bank.Web.Host.wwwroot.swagger.ui.index.html")
I’m assuming that Swagger automatically gets the Uiindex.html
file fromwwwroot
I had the same problem, and it was because I changed the name of the XXX.Web.Host project. It was solved by changing where it says GetManifestResourceStream (“XXX.Web.Host.wwwroot.swagger.ui.index.html”) by GetManifestResourceStream (“YYY.Web.Host.wwwroot.swagger.ui.index.html”) where YYY is the new name of the project (YYY.Web.Host)