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); 就好了
![](https://img2018.cnblogs.com/blog/1406833/201906/1406833-20190622112932168-2022308536.png)
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)
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 登出一次 再登录就可以了(花了一天半的时间,各种都尝试过了,有其他更好想法的,欢迎砸砖)
![](https://img2018.cnblogs.com/blog/1406833/201907/1406833-20190723172704818-684132704.png)
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.
原因,程序里面同时使用了同步和异步,全部改为异步就可以了