Hi @liangshiwei,
Redis is endabled now and I am able to see the data in Redis Studio as well.
But still in log.txt I am getting below mentioned logs :
[DBG] Not found in the cache: pn:C,pk:Litmus_App,n:ProfileManagement.Supplier
Still getting same error's on UI :
An error has occurred! Authorization failed! Given policy has not granted.
@liangshiwei
Can you provide the links which you shared during the session here ?
Thanks
@liangshiwei,
We can connect, so I can give your brief understanding on my project and If needed I will provide you the steps how we build our project. Please let me know how can we connect.
Thanks
HI @liangshiwei,
Sorry but replicating the architecture will be time taking and we need to resolve it in a give timeline, Can we just connect and may be you can have a look of the project structure and code ? It will be really helpfull
Thanks
Hi @alpher,
I tried implementing your solution but now I am facing the below issue :
SQLite Error 1: 'no such table: AbpUsers'.
Hi,
If you go through all the above mentioned issue, I was finally able to create users in Project B. But now in Project B all unit test cases are failing and all have the same error as below :
Message:
Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule, Volo.Abp.AspNetCore.Mvc, Version=3.0.4.0, Culture=neutral, PublicKeyToken=null: Could not find singleton service: Microsoft.AspNetCore.Hosting.IWebHostEnvironment, Microsoft.AspNetCore.Hosting.Abstractions, Version=3.1.12.0, Culture=neutral, PublicKeyToken=adb9793829ddae60. See the inner exception for details.
---- System.InvalidOperationException : Could not find singleton service: Microsoft.AspNetCore.Hosting.IWebHostEnvironment, Microsoft.AspNetCore.Hosting.Abstractions, Version=3.1.12.0, Culture=neutral, PublicKeyToken=adb9793829ddae60
Stack Trace:
ModuleManager.InitializeModules(ApplicationInitializationContext context)
AbpApplicationBase.InitializeModules()
AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
AbpIntegratedTest`1.ctor()
ProfileManagementTestBase`1.ctor()
ProfileManagementApplicationTestBase.ctor()
XYZAppServiceTests.ctor() line 12
----- Inner Stack Trace -----
ServiceCollectionCommonExtensions.GetSingletonInstance[T](IServiceCollection services)
AbpAspNetCoreServiceCollectionExtensions.GetHostingEnvironment(IServiceCollection services)
<>c__DisplayClass1_0.<ConfigureServices>b__2(AbpAspNetCoreMvcOptions options)
PostConfigureOptions`1.PostConfigure(String name, TOptions options)
OptionsFactory`1.Create(String name)
<>c__DisplayClass5_0.<Get>b__0()
Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
Lazy`1.CreateValue()
Lazy`1.get_Value()
OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
OptionsManager`1.Get(String name)
OptionsManager`1.get_Value()
AbpAspNetCoreMvcModule.AddApplicationParts(ApplicationInitializationContext context)
AbpAspNetCoreMvcModule.OnApplicationInitialization(ApplicationInitializationContext context)
OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module)
ModuleManager.InitializeModules(ApplicationInitializationContext context)
Sorry to reopen the ticket, but to understand the issue I thought It would be better to mention it here itself.
@gterdem
Yup only Module Dependencies part was missing, once I added those dependencies it worked. Thanks alot !!! Appreciate your quick response.
Hi @gterdem ,
Sorry my bad, copy paste issue.
These are the packages
<PackageReference Include="Volo.Abp.Identity.Application" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Identity.EntityFrameworkCore" Version="3.0.4" />
<PackageReference Include="Volo.Abp.Identity.HttpApi" Version="3.0.4" />
Still facing same issues
Hi
I installed these packages from nuget manager as below
<PackageReference Include="Identity.EntityFrameworkCore" Version="1.2.7" />
<PackageReference Include="Volo.Abp.Auditing" Version="3.0.4" />
<PackageReference Include="Volo.Abp.AuditLogging.Domain" Version="3.0.4" />
My AppService.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Localization;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Identity;
public class SupplierRegistrationAppService : ProfileManagementAppService, ISupplierRegistrationAppService
{
private readonly IdentityUserManager _identityUserManager;
private readonly IIdentityRoleRepository _identityRoleRepository;
public SupplierRegistrationAppService(
IdentityUserManager identityUserManager,
IIdentityRoleRepository identityRoleRepository
)
{
_identityUserManager = identityUserManager;
_identityRoleRepository = identityRoleRepository;
}
public async Task<LitmusUserOutputDto> CreateUserAsync(LitmusUserCreateDto input)
{
var output = new LitmusUserOutputDto();
if (input.TenantId.HasValue)
{
using (CurrentTenant.Change(input.TenantId))
{
//User
var user = new Volo.Abp.Identity.IdentityUser(GuidGenerator.Create(), input.UserName, input.EmailAddress, CurrentTenant.Id);
(await _identityUserManager.CreateAsync(user, input.Password)).CheckErrors();
await _identityUserManager.SetEmailAsync(user, input.EmailAddress);
user.Name = input.FirstName;
user.Surname = input.LastName;
//Role
IEnumerable<string> rolesIEnum = await GetRoleNames(input.RoleName);
await _identityUserManager.SetRolesAsync(user, rolesIEnum);
//Output
output.EmailId = user.Email;
output.Password = input.Password;
output.UserId = user.Id;
}
}
else
throw new Exception("Tenant Id cannot be empty in CreateAsync()");
return output;
}
private async Task<IEnumerable<string>> GetRoleNames(string RoleName)
{
var roles = await _identityRoleRepository.GetListAsync();
var role = roles.Where(x => x.Name.Equals(RoleName)).FirstOrDefault();
var rolesList = new List<string>() { role.Name };
IEnumerable<string> rolesIEnum = rolesList;
return rolesIEnum;
}
}
My Controller.cs
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
namespace SCV.Litmus.ProfileManagement.SupplierRegistrations
{
[RemoteService]
[Route("profile/api/ProfileManagement")]
public class SupplierRegistrationController : ProfileManagementController, ISupplierRegistrationAppService
{
private readonly ISupplierRegistrationAppService _SupplierRegistrationAppService;
public SupplierRegistrationController(ISupplierRegistrationAppService SupplierRegistrationAppService)
{
_SupplierRegistrationAppService = SupplierRegistrationAppService;
}
[HttpPost]
[Route("createUser")]
public virtual Task<LitmusUserOutputDto> CreateUserAsync(LitmusUserCreateDto input)
{
return _SupplierRegistrationAppService.CreateUserAsync(input);
}
}
}
I was able to get references, but now executing this method I am getting the below error :
2021-03-22 16:31:36.999 +05:30 [ERR] An exception was thrown while activating SCV.Litmus.ProfileManagement.SupplierRegistrations.SupplierRegistrationController -> SCV.Litmus.ProfileManagement.SupplierRegistrations.SupplierRegistrationAppService.
Autofac.Core.DependencyResolutionException: An exception was thrown while activating SCV.Litmus.ProfileManagement.SupplierRegistrations.SupplierRegistrationController -> SCV.Litmus.ProfileManagement.SupplierRegistrations.SupplierRegistrationAppService.
---> Autofac.Core.DependencyResolutionException: None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'SCV.Litmus.ProfileManagement.SupplierRegistrations.SupplierRegistrationAppService' can be invoked with the available services and parameters:
Cannot resolve parameter 'Volo.Abp.Identity.IdentityUserManager identityUserManager' of constructor 'Void .ctor(SCV.Litmus.ProfileManagement.SupplierRegistrations.ISupplierRegistrationRepository, SCV.Litmus.ProfileManagement.Suppliers.ISupplierRepository, SCV.Litmus.ProfileManagement.Suppliers.ISupplierCodeRepository, SCV.Litmus.ProfileManagement.BusinessEntities.IBusinessEntityRepository, SCV.Litmus.ProfileManagement.SupplierUserProfiles.ISupplierUserProfileRepository, SCV.Litmus.ProfileManagement.SharedServices.ISharedAppService, Volo.Abp.Identity.IdentityUserManager, Volo.Abp.Identity.IIdentityRoleRepository)'.
at Autofac.Core.Activators.Reflection.ReflectionActivator.GetValidConstructorBindings(ConstructorInfo[] availableConstructors, IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.CreateInstance(IEnumerable`1 parameters)
--- End of inner exception stack trace ---
at Autofac.Core.Resolving.InstanceLookup.CreateInstance(IEnumerable`1 parameters)
at Autofac.Core.Resolving.InstanceLookup.Execute()
at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.ResolveComponent(ResolveRequest request)
at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext)
at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
2021-03-22 16:31:37.043 +05:30 [ERR] ---------- Exception Data ----------
2021-03-22 16:31:37.044 +05:30 [ERR] ActivatorChain = SCV.Litmus.ProfileManagement.SupplierRegistrations.SupplierRegistrationController -> SCV.Litmus.ProfileManagement.SupplierRegistrations.SupplierRegistrationAppService
Hi @bunyamin,
I tried this observe: 'response'
but I was getting header as null, Is there any other way ?
Cause as I said before If I try abp.io rest service then I am getting json parsing error
and if I try by angular http approach I am able download the file but I am not able to get access of Content-Disposition where I am getting name of the file. Please check my code above once for your reference.