启动模板项目时出现错误:Abp.AbpException
:
没有给定ID的租户:2
我已经检查了数据库,有默认的租户和用户。但是无法加载Swagger并显示错误:
提取错误内部服务器错误http://localhost:21021/swagger/v1/swagger.json。
检查了txt日志,以下是错误堆栈,这使承租人ID 2传递到哪里感到困惑。
错误2019-01-09 14:54:25,221 [7] Microsoft.AspNetCore.Server.Kestrel-连接ID“ 0HLJLVT04BST8”,请求ID“ 0HLJLVT04BST8:00000003”:应用程序引发了未处理的异常。
Abp.AbpException:没有给定ID为2的租户
在Abp.MultiTenancy.TenantCache 2.Get(Int32 tenantId) in D:\Github\aspnetboilerplate\src\Abp.Zero.Common\MultiTenancy\TenantCache.cs:line 35 at Castle.Proxies.Invocations.TenantCache
2_Get.InvokeMethodOnTarget()
在Castle.DynamicProxy.AbstractInvocation.Proceed()
在Castle.DynamicProxy.AbstractInvocation.Proceed()
在Castle.Proxies.TenantCache 2Proxy.Get(Int32 tenantId) at Abp.Zero.EntityFrameworkCore.DbPerTenantConnectionStringResolver.GetNameOrConnectionString(DbPerTenantConnectionStringResolveArgs args) in D:\Github\aspnetboilerplate\src\Abp.ZeroCore.EntityFrameworkCore\Zero\EntityFrameworkCore\DbPerTenantConnectionStringResolver.cs:line 50 at Abp.Zero.EntityFrameworkCore.DbPerTenantConnectionStringResolver.GetNameOrConnectionString(ConnectionStringResolveArgs args) in D:\Github\aspnetboilerplate\src\Abp.ZeroCore.EntityFrameworkCore\Zero\EntityFrameworkCore\DbPerTenantConnectionStringResolver.cs:line 45 at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable
1 multiTenancySide,字符串名称)在D:\ Github \ aspnetboilerplate \ src \ Abp.EntityFrameworkCore \ EntityFrameworkCore \ Uow \ EfCoreUnitOfWork.cs:第107行
在Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase 3.get_Table() in D:\Github\aspnetboilerplate\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Repositories\EfCoreRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 39 at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase
3.GetAllIn included(Expression 1[] propertySelectors) in D:\Github\aspnetboilerplate\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Repositories\EfCoreRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 88 at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase
3.GetAllListAsync(Expression 1 predicate) in D:\Github\aspnetboilerplate\src\Abp.EntityFrameworkCore\EntityFrameworkCore\Repositories\EfCoreRepositoryBaseOfTEntityAndTPrimaryKey.cs:line 108 at Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinallyAndGetResult[T](Task
1 ActualReturnValue,Func 1 postAction, Action
1 finalAction))中
在D:\ Github \ aspnetboilerplate \ src \ Abp.Zero.Common \ Configuration \ SettingStore.cs:line 40中的Abp.Configuration.SettingStore.GetAllListAsync(Nullable 1 tenantId, Nullable
1 userId)
在Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinallyAndGetResult [T](Task 1 actualReturnValue, Func
1 postAction,Action 1 finalAction) at Abp.Configuration.SettingManager.<>c__DisplayClass40_0.<<GetUserSettingsFromCache>b__0>d.MoveNext() in D:\Github\aspnetboilerplate\src\Abp\Configuration\SettingManager.cs:line 436 --- End of stack trace from previous location where exception was thrown --- at Abp.Runtime.Caching.CacheExtensions.<>c__DisplayClass9_0
2. d.MoveNext()
---从之前引发异常的位置开始的堆栈结束跟踪---
在Abp.Runtime.Caching.CacheBase.GetAsync(字符串键,Func 2 factory) in D:\Github\aspnetboilerplate\src\Abp\Runtime\Caching\CacheBase.cs:line 182 at Abp.Runtime.Caching.CacheExtensions.GetAsync[TKey,TValue](ICache cache, TKey key, Func
2工厂)在D:\ Github \ aspnetboilerplate \ src \ Abp \ Runtime \ Caching \ CacheExtensions.cs:line 60
在D:\ Github \ aspnetboilerplate \ src \ Abp \ Configuration \ SettingManager.cs:line 430中的Abp.Configuration.SettingManager.GetUserSettingsFromCache(UserIdentifier user)
在D:\ Github \ aspnetboilerplate \ src \ Abp \ Configuration \ SettingManager.cs:line 403中的Abp.Configuration.SettingManager.GetReadOnlyUserSettings(UserIdentifier用户)处
在Abp.Configuration.SettingManager.GetSettingValueForUserOrNullAsync(UserIdentifier用户,字符串名称)在D:\ Github \ aspnetboilerplate \ src \ Abp \ Configuration \ SettingManager.cs:line 373
在Abp.Configuration.SettingManager.GetSettingValueInternalAsync(字符串名称,Nullable 1 tenantId, Nullable
1 userId,布尔fallbackToDefault)在D:\ Github \ aspnetboilerplate \ src \ Abp \ Configuration \ SettingManager.cs:line 235
在D:\ Github \ aspnetboilerplate \ src \ Abp.AspNetCore \ AspNetCore \ Localization \ AbpUserRequestCultureProvider.cs:line 29中的Abp.AspNetCore.Localization.AbpUserRequestCultureProvider.DetermineProviderCultureResult(HttpContext httpContext)中
在Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext上下文)
在Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext上下文)
在Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext上下文)
在Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.Invoke(HttpContext上下文)
在Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.Invoke(HttpContext httpContext)在D:\ Github \ aspnetboilerplate \ src \ Abp.AspNetCore \ AspNetCore \ Security \ AbpSecurityHeadersMiddleware.cs:line 26
在Microsoft.AspNetCore.Server.IISIntegration.IISMiddleware.Invoke(HttpContext httpContext)
在Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpProtocol.ProcessRequests [TContext](IHttpApplication`1应用程序)
INFO 2019-01-09 14:54:25,227 [7] soft.AspNetCore.Hosting.Internal.WebHost-请求已在182.7895ms中完成500
最佳答案
是昨天批准了swagger的浏览器swagger缓存问题。
清除浏览器缓存后,效果很好。这就是为什么有一个租户ID 2的原因。
关于mysql - Abp.AbpException:没有给定ID为2的租户,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54104739/