Abp.AbpException:没有给定ID为2

时间:2019-01-09 07:01:30

标签: mysql aspnetboilerplate

启动模板项目时出现错误: 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行      at 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.GetAllIninclude(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)处      at 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()   ---从之前引发异常的位置开始的堆栈结束跟踪---      在D:\ Github \ aspnetboilerplate \ src \ Abp \ Runtime \ Caching \ CacheExtensions.cs:line 60中的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 \ 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(String name,Nullable 1 tenantId, Nullable 1 userId,Boolean 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中完成

1 个答案:

答案 0 :(得分:0)

是昨天我授权了摇摇欲坠的浏览器Swagger缓存问题。

最好清除浏览器缓存。那就是为什么有一个房客ID 2的原因。