Hello, when the application is run in a local database normal application runs but when I point to another server and change the database name displays the following error, can anyone help me?
Thanks
Connectionstring
<connectionStrings> <add name="Default" connectionString="Server=XXX; Database=DB_CORP; Trusted_Connection=True;" providerName="System.Data.SqlClient" /> </connectionStrings>
Error:
Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Abp.MultiTenancy.TenantCache2.CreateTenantCacheItem(TTenant tenant) in D:\Halil\GitHub\module-zero\src\Abp.Zero\MultiTenancy\TenantCache.cs:82 Castle.Proxies.TenantCache
2Proxy.CreateTenantCacheItem_callback(Tenant tenant) +5
Castle.Proxies.Invocations.TenantCache2_CreateTenantCacheItem.InvokeMethodOnTarget() +69 Castle.DynamicProxy.AbstractInvocation.Proceed() +80 Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:29 Castle.DynamicProxy.AbstractInvocation.Proceed() +108 Castle.Proxies.TenantCache
2Proxy.CreateTenantCacheItem(Tenant tenant) +141
Abp.MultiTenancy.<>c__DisplayClass7_0.<GetOrNull>b__0() in D:\Halil\GitHub\module-zero\src\Abp.Zero\MultiTenancy\TenantCache.cs:75
Abp.Runtime.Caching.<>c__DisplayClass0_02.<Get>b__0(TKey k) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\TypedCacheExtensions.cs:13 Abp.Runtime.Caching.<>c__DisplayClass3_0
2.<Get>b__0(String k) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:28
Abp.Runtime.Caching.CacheBase.Get(String key, Func2 factory) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheBase.cs:42 Abp.Runtime.Caching.CacheExtensions.Get(ICache cache, TKey key, Func
2 factory) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:28
Abp.Runtime.Caching.TypedCacheWrapper2.Get(TKey key, Func
2 factory) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\TypedCacheWrapper.cs:52
Abp.Runtime.Caching.TypedCacheExtensions.Get(ITypedCache2 cache, TKey key, Func
1 factory) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Runtime\Caching\TypedCacheExtensions.cs:13
Abp.MultiTenancy.TenantCache2.GetOrNull(Int32 tenantId) in D:\Halil\GitHub\module-zero\src\Abp.Zero\MultiTenancy\TenantCache.cs:68 Abp.MultiTenancy.TenantCache
2.Get(Int32 tenantId) in D:\Halil\GitHub\module-zero\src\Abp.Zero\MultiTenancy\TenantCache.cs:31
Castle.Proxies.TenantCache2Proxy.Get_callback(Int32 tenantId) +5 Castle.Proxies.Invocations.TenantCache
2_Get.InvokeMethodOnTarget() +67
Castle.DynamicProxy.AbstractInvocation.Proceed() +80
Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:29
Castle.DynamicProxy.AbstractInvocation.Proceed() +108
Castle.Proxies.TenantCache2Proxy.Get(Int32 tenantId) +155 Abp.Zero.EntityFramework.DbPerTenantConnectionStringResolver.GetNameOrConnectionString(DbPerTenantConnectionStringResolveArgs args) in D:\Halil\GitHub\module-zero\src\Abp.Zero.EntityFramework\Zero\EntityFramework\DbPerTenantConnectionStringResolver.cs:51 Abp.Zero.EntityFramework.DbPerTenantConnectionStringResolver.GetNameOrConnectionString(ConnectionStringResolveArgs args) in D:\Halil\GitHub\module-zero\src\Abp.Zero.EntityFramework\Zero\EntityFramework\DbPerTenantConnectionStringResolver.cs:46 Abp.Domain.Uow.UnitOfWorkBase.ResolveConnectionString(ConnectionStringResolveArgs args) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkBase.cs:332 Abp.EntityFramework.Uow.EfUnitOfWork.GetOrCreateDbContext(Nullable
1 multiTenancySide) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\EfUnitOfWork.cs:145
Abp.EntityFramework.Uow.UnitOfWorkExtensions.GetDbContext(IActiveUnitOfWork unitOfWork, Nullable1 multiTenancySide) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\UnitOfWorkExtensions.cs:38 Abp.EntityFramework.Uow.UnitOfWorkDbContextProvider
1.GetDbContext(Nullable1 multiTenancySide) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\UnitOfWorkDbContextProvider.cs:38 Castle.Proxies.EfRepositoryBase
3Proxy_2.get_Context_callback() +45
Castle.Proxies.Invocations.EfRepositoryBase3_get_Context_2.InvokeMethodOnTarget() +28 Castle.DynamicProxy.AbstractInvocation.Proceed() +80 Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:53 Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:45 Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:35 Castle.DynamicProxy.AbstractInvocation.Proceed() +108 Castle.Proxies.EfRepositoryBase
3Proxy_2.get_Context() +126
Abp.EntityFramework.Repositories.EfRepositoryBase3.get_Table() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:30 Castle.Proxies.EfRepositoryBase
3Proxy_2.get_Table_callback() +4
Castle.Proxies.Invocations.EfRepositoryBase3_get_Table_2.InvokeMethodOnTarget() +28 Castle.DynamicProxy.AbstractInvocation.Proceed() +80 Abp.Domain.Uow.UnitOfWorkInterceptor.PerformSyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:53 Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:45 Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:35 Castle.DynamicProxy.AbstractInvocation.Proceed() +108 Castle.Proxies.EfRepositoryBase
3Proxy_2.get_Table() +126
Abp.EntityFramework.Repositories.EfRepositoryBase3.InsertAsync(TEntity entity) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Repositories\EfRepositoryBaseOfTEntityAndTPrimaryKey.cs:80 Castle.Proxies.EfRepositoryBase
3Proxy_2.InsertAsync_callback(AuditLog entity) +5
Castle.Proxies.Invocations.EfRepositoryBase3_InsertAsync_2.InvokeMethodOnTarget() +68 Castle.DynamicProxy.AbstractInvocation.Proceed() +80 Abp.Domain.Uow.UnitOfWorkInterceptor.PerformAsyncUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:62 Abp.Domain.Uow.UnitOfWorkInterceptor.PerformUow(IInvocation invocation, UnitOfWorkOptions options) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:41 Abp.Domain.Uow.UnitOfWorkInterceptor.Intercept(IInvocation invocation) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:35 Castle.DynamicProxy.AbstractInvocation.Proceed() +108 Castle.Proxies.EfRepositoryBase
3Proxy_2.InsertAsync(AuditLog entity) +141
Abp.Auditing.AuditingStore.SaveAsync(AuditInfo auditInfo) in D:\Halil\GitHub\module-zero\src\Abp.Zero\Auditing\AuditingStore.cs:24
Abp.Auditing.<>c__DisplayClass0_0.<Save>b__0() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Auditing\AuditingStoreExtensions.cs:17
System.Threading.Tasks.Task1.InnerInvoke() +56 System.Threading.Tasks.Task.Execute() +49 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 Nito.AsyncEx.<>c__DisplayClass3.<Run>b__1(Task t) +56 System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke() +52 System.Threading.Tasks.Task.Execute() +49 System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +92 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58 Nito.AsyncEx.AsyncContext.Run(Func
1 action) +199
Abp.Auditing.AuditingStoreExtensions.Save(IAuditingStore auditingStore, AuditInfo auditInfo) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Auditing\AuditingStoreExtensions.cs:17
Abp.Web.Mvc.Auditing.AbpMvcAuditFilter.OnActionExecuted(ActionExecutedContext filterContext) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web.Mvc\Web\Mvc\Auditing\AbpMvcAuditFilter.cs:98
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +253
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResultBase
1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
System.Web.Mvc.Async.WrappedAsyncResult1.CallEndDelegate(IAsyncResult asyncResult) +10 System.Web.Mvc.Async.WrappedAsyncResultBase
1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase
1.End() +49
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +22 System.Web.Mvc.Async.WrappedAsyncResultBase
1.End() +49
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
System.Web.Mvc.Async.WrappedAsyncVoid1.CallEndDelegate(IAsyncResult asyncResult) +29 System.Web.Mvc.Async.WrappedAsyncResultBase
1.End() +49
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9644097
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
2 Answer(s)
-
0
Hi,
Can you try to clean your solution after changing your connectionString and run it again ?
Probably tenants in the local database stays in the tenant cache after changing the connectinString and your second database does not have some of the tenants in your local database.
-
0
Hi ismcagdas !
Now it's working ! Thanks ! :D