ABP错误笔记

 1、System.InvalidOperationException:“Unable to determine the relationship represented by navigation property 'User.DeleterUser' of type 'User'. Either manually configure the relationship, or ignore this property using the '[NotMapped]' attribute or by using 'EntityTypeBuilder.Ignore' in 'OnModelCreating'.” 
 
原因:在EF层XXXMLCDZDbContext中OnModelCreating 下缺少对初始化的配置,加上base.OnModelCreating(modelBuilder); 就好了
2、
 An unhandled exception occurred while processing the request.
ComponentNotFoundException: No component for supporting the service MLCDZ.Web.Mvc.Areas.ABase.Controllers.DictionaryController was found
Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy, bool ignoreParentContext) 
原因:1、路由规则可能没有写对了,2,Control没有继承自XXXControllerBase。
有个网友的解决办法是 https://www.cnblogs.com/saving/p/10385382.html ,但是对我没用
我的是第二条,实际上修改了控制器的继承类后,路由规则直接用默认的就可以了,都不用改
 
3、Areas 区域内页面样式丢失
这个手动在页面加上    Layout = "~/Views/Shared/_Layout.cshtml"; 引入母版页就可以了
 
4、在Areas区域中使用多语言
在区域中使用多语言会提示 当前上下文中不存在名称“L”,解决办法,将View中的_ViewImports.cshtml 复制一份到区域中就可以了
 
5、页面选择多租户的时候,有一个就是报错 AbpServiceProxies/GetAll
仔细看报错提示或者log,很有可能是后台某些地方不符合规范,我的错误是应用层方法的参数只能传一个 而我传了多个
 
6、动态修改租户ID
 ,Abp官方提供的方法都是临时的,包括,AbpSession.Use(2, AbpSession.UserId);和_unitOfWorkManager.Current.SetTenantId(TenantId),主要技巧就是要移除Claim 登出一次 再登录就可以了(花了一天半的时间,各种都尝试过了,有其他更好想法的,欢迎砸砖)

 7、同一个程序 有时候执行返回正常,有时候返回不正常,或者正常执行但是返回代码不对,异常日志还各不相同,像如下

1)、Self referencing loop detected for property 'Task' with type 'System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1+AsyncStateMachineBox`1[MLCDZ.Common.Entity.LayPagedDto`1

2)、An unhandled exception was thrown by the application.

原因,程序里面同时使用了同步和异步,全部改为异步就可以了

 

转载于:https://www.cnblogs.com/bamboo-zhang/p/11068257.html

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值