From stdout logging
Application startup exception: Castle.MicroKernel.ComponentActivator.ComponentActivatorException: ComponentActivator: could not instantiate Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer
---> System.Exception: Could not instantiate Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer.
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.AspNetCore.Hosting.WebHostBuilderIISExtensions.<>c__DisplayClass0_0.<UseIIS>b__2(IISServerOptions options)
at Microsoft.Extensions.Options.ConfigureNamedOptions1.Configure(String name, TOptions options) at Microsoft.Extensions.Options.OptionsFactory
1.Create(String name)
at Microsoft.Extensions.Options.OptionsManager1.<>c__DisplayClass5_0.<Get>b__0() at System.Lazy
1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy
1.CreateValue()
at System.Lazy1.get_Value() at Microsoft.Extensions.Options.OptionsCache
1.GetOrAdd(String name, Func1 createOptions) at Microsoft.Extensions.Options.OptionsManager
1.Get(String name)
at Microsoft.Extensions.Options.OptionsManager1.get_Value() at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer..ctor(IISNativeApplication nativeApplication, IHostApplicationLifetime applicationLifetime, IAuthenticationSchemeProvider authentication, IOptions
1 options, ILogger1 logger) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) --- End of inner exception stack trace --- at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) --- End of inner exception stack trace --- at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments) at Castle.Windsor.WindsorContainer.Resolve(Type service) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.ResolveInstanceOrNull(Type serviceType, Boolean isOptional) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetRequiredService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.AspNetCore.Hosting.WebHost.EnsureServer() at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication() crit: Microsoft.AspNetCore.Hosting.WebHost[6] Application startup exception Castle.MicroKernel.ComponentActivator.ComponentActivatorException: ComponentActivator: could not instantiate Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer ---> System.Exception: Could not instantiate Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.AspNetCore.Hosting.WebHostBuilderIISExtensions.<>c__DisplayClass0_0.<UseIIS>b__2(IISServerOptions options) at Microsoft.Extensions.Options.ConfigureNamedOptions
1.Configure(String name, TOptions options)
at Microsoft.Extensions.Options.OptionsFactory1.Create(String name) at Microsoft.Extensions.Options.OptionsManager
1.<>c__DisplayClass5_0.<Get>b__0()
at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy
1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy1.CreateValue() at System.Lazy
1.get_Value()
at Microsoft.Extensions.Options.OptionsCache1.GetOrAdd(String name, Func
1 createOptions)
at Microsoft.Extensions.Options.OptionsManager1.Get(String name) at Microsoft.Extensions.Options.OptionsManager
1.get_Value()
at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer..ctor(IISNativeApplication nativeApplication, IHostApplicationLifetime applicationLifetime, IAuthenticationSchemeProvider authentication, IOptions1 options, ILogger
1 logger)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs)
--- End of inner exception stack trace ---
at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)
--- End of inner exception stack trace ---
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context)
at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden)
at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally)
at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy)
at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext)
at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext)
at Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments)
at Castle.Windsor.WindsorContainer.Resolve(Type service)
at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.ResolveInstanceOrNull(Type serviceType, Boolean isOptional)
at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional)
at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetRequiredService(Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
at Microsoft.AspNetCore.Hosting.WebHost.EnsureServer()
at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
Some more from logging:;
Application '/LM/W3SVC/7/ROOT' with physical root 'E:\ProcessSuiteWebsites\wfm1test-webapi.pli-solutions.de' hit unexpected managed exception, exception code = '0xe0434352'. Last 4KB characters of captured stdout and stderr logs: Application startup exception: Castle.MicroKernel.ComponentActivator.ComponentActivatorException: ComponentActivator: could not instantiate Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer ---> System.Exception: Could not instantiate Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.AspNetCore.Hosting.WebHostBuilderIISExtensions.<>c__DisplayClass0_0.<UseIIS>b__2(IISServerOptions options) at Microsoft.Extensions.Options.ConfigureNamedOptions1.Configure(String name, TOptions options) at Microsoft.Extensions.Options.OptionsFactory
1.Create(String name) at Microsoft.Extensions.Options.OptionsManager1.<>c__DisplayClass5_0.<Get>b__0() at System.Lazy
1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy
1.CreateValue() at System.Lazy1.get_Value() at Microsoft.Extensions.Options.OptionsCache
1.GetOrAdd(String name, Func1 createOptions) at Microsoft.Extensions.Options.OptionsManager
1.Get(String name) at Microsoft.Extensions.Options.OptionsManager1.get_Value() at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer..ctor(IISNativeApplication nativeApplication, IHostApplicationLifetime applicationLifetime, IAuthenticationSchemeProvider authentication, IOptions
1 options, ILogger1 logger) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) --- End of inner exception stack trace --- at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) --- End of inner exception stack trace --- at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments) at Castle.Windsor.WindsorContainer.Resolve(Type service) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.ResolveInstanceOrNull(Type serviceType, Boolean isOptional) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetRequiredService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.AspNetCore.Hosting.WebHost.EnsureServer() at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication() crit: Microsoft.AspNetCore.Hosting.WebHost[6] Application startup exception Castle.MicroKernel.ComponentActivator.ComponentActivatorException: ComponentActivator: could not instantiate Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer ---> System.Exception: Could not instantiate Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.AspNetCore.Hosting.WebHostBuilderIISExtensions.<>c__DisplayClass0_0.<UseIIS>b__2(IISServerOptions options) at Microsoft.Extensions.Options.ConfigureNamedOptions
1.Configure(String name, TOptions options) at Microsoft.Extensions.Options.OptionsFactory1.Create(String name) at Microsoft.Extensions.Options.OptionsManager
1.<>c__DisplayClass5_0.<Get>b__0() at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy
1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy1.CreateValue() at System.Lazy
1.get_Value() at Microsoft.Extensions.Options.OptionsCache1.GetOrAdd(String name, Func
1 createOptions) at Microsoft.Extensions.Options.OptionsManager1.Get(String name) at Microsoft.Extensions.Options.OptionsManager
1.get_Value() at Microsoft.AspNetCore.Server.IIS.Core.IISHttpServer..ctor(IISNativeApplication nativeApplication, IHostApplicationLifetime applicationLifetime, IAuthenticationSchemeProvider authentication, IOptions1 options, ILogger
1 logger) --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) --- End of inner exception stack trace --- at Castle.Core.Internal.ReflectionUtil.Instantiate[TBase](Type subtypeofTBase, Object[] ctorArgs) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) --- End of inner exception stack trace --- at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstanceCore(ConstructorCandidate constructor, Object[] arguments, Type implType) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.CreateInstance(CreationContext context, ConstructorCandidate constructor, Object[] arguments) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.Instantiate(CreationContext context) at Castle.MicroKernel.ComponentActivator.DefaultComponentActivator.InternalCreate(CreationContext context) at Castle.MicroKernel.ComponentActivator.AbstractComponentActivator.Create(CreationContext context, Burden burden) at Castle.MicroKernel.Lifestyle.AbstractLifestyleManager.CreateInstance(CreationContext context, Boolean trackedExternally) at Castle.MicroKernel.Lifestyle.SingletonLifestyleManager.Resolve(CreationContext context, IReleasePolicy releasePolicy) at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.Handlers.AbstractHandler.Resolve(CreationContext context) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments) at Castle.Windsor.WindsorContainer.Resolve(Type service) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.ResolveInstanceOrNull(Type serviceType, Boolean isOptional) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetRequiredService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.AspNetCore.Hosting.WebHost.EnsureServer() at Microsoft.AspNetCore.Hosting.WebHost.BuildApplication()
Process Id: 13240.
File Version: 12.2.18316.0. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: ce8cf65589734f82b0536c543aba5bd60d0a5a98
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
I'm getting an error suddenly - it was all working. now today I'm getting:
Access to XMLHttpRequest at 'https://XXX/AbpUserConfiguration/GetAll?d=1640081097099' from origin 'https://https://XXX' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. dp1-webapi.pli-solutions.de/AbpUserConfiguration/GetAll?d=1640081097099:1 Failed to load resource: net::ERR_FAILED contentscript.bundle.js:85 successfully updated user preferred location DevTools failed to load source map: Could not load content for https://dp1.pli-solutions.de/assets/common/min-maps/vs/loader.js.map: HTTP error: status code 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
Maybe it searches in host - not in Tenant? We use this search user by email implemantion which you documented in one of your docs
Maybe it searches in host - not in Tenant?
But here the whole code:
// Find user in our database
using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant))
{
Logger.Info("CurrentUnitOfWork.SetTenantId(tenantId) - Success: TenantId = " + tenantId.ToString());
// Step 1: FindByEmailAsync
user = await _userManager.FindByEmailAsync(userSSO);
if (user != null)
{
Logger.Info("Find user in our database successful (FindByEmailAsync): " + user.UserName);
}
// Step 2: FindByNameAsync
if (user == null)
{
user = await _userManager.FindByNameAsync(userSSO);
if (user != null)
{
Logger.Info("Find user in our database successful (FindByNameAsync): " + user.UserName);
}
}
// }
using (CurrentUnitOfWork.SetTenantId(tenantId))
{
if (user == null)
{
Logger.Info("user == null");
string fName;
string lName;
if (ssoResult.UserID.Contains("@"))
{
int indexOf = ssoResult.UserID.IndexOf("@");
fName = ssoResult.UserID.Substring(0, indexOf);
lName = ssoResult.UserID.Substring(indexOf + 1);
Logger.Info("ssoResult.UserID.Contains @");
}
// LDAP User
else if (ssoResult.UserID.Contains("\\"))
{
int indexOf = ssoResult.UserID.IndexOf("\\");
fName = ssoResult.UserID.Substring(0, indexOf);
lName = ssoResult.UserID.Substring(indexOf + 1);
Logger.Info("ssoResult.UserID.Contains \\");
}
else
{
fName = ssoResult.UserID;
lName = ssoResult.UserID;
Logger.Info("ssoResult - else");
}
string newPassword = _passwordHasher.HashPassword(user, _appConfiguration["PLI_SsoSettings:SSOUserPassword"]);
user = new User
{
EmailAddress = userNameOrEmail,
IsEmailConfirmed = true,
Name = fName,
Surname = lName,
UserName = userSSO,
Password = newPassword, //hashPassword
TenantId = tenantId
};
// If the user doesn't exist locally then create the user.
IdentityResult result = await _userManager.CreateAsync(user);
if (!result.Succeeded)
{
Logger.Info("IdentityResult result = await _userManager.CreateAsync(user) = UserNotCreated");
throw new UserFriendlyException(L("UserNotCreated"));
}
else
{
Logger.Info("user = new User created - UserName: " + userSSO + " TenantId: " + tenantId.ToString());
}
//get Employee role value for existing & create new if not existing
IQueryable<Role> query = _roleManager.Roles;
Role roleExists = GetRole(query);
string roleName="";
if (roleExists != null)
{
try
{
roleName = query.ToList().FirstOrDefault(x => x.IsDefault == true).Name;
Logger.Info("roleName = query.ToList().FirstOrDefault(x => x.IsDefault == true).Name");
}
catch(Exception ex)
{
Logger.Error(ex.Message.ToString());
}
}
else
{
Role newRole = new Role(tenantId, "Employee") { IsDefault = false, Name = "Employee" };
CheckErrors(await _roleManager.CreateAsync(newRole));
await CurrentUnitOfWork.SaveChangesAsync();
roleExists = GetRole(query);
roleName = roleExists.Name;
Logger.Info("Role newRole = new Role(tenantId");
}
string[] role = new string[] { roleName };
result = await _userManager.SetRolesAsync(user, role);
Logger.Info("await _userManager.SetRolesAsync(user, role)");
if (!result.Succeeded)
{
throw new UserFriendlyException(L("UserRollNotAssigned"));
}
}
//}
else
{
await _userManager.ChangePasswordAsync(user, _appConfiguration["PLI_SsoSettings:SSOUserPassword"]);
}
// OM: ASYNC would be good
CallPRSUserAPI(tenantId, userSSO, userSSOOriginal);
string allowedURLList = _appConfiguration["PLI_SsoSettings:AllowedURLList"];
// var list = .Spli t(",");
var allowedURL = allowedURLList.Split(',').ToList();
//this line create a arraylist using array elements.
// var fileList = new List(stringArray);
var str = allowedURL.Any(url => (ssoResult.RelayState).Contains(url));
// Add new SP-Providers here
if (str)
{
Dictionary<string, string> queryParams = new Dictionary<string, string>()
{
{"tenantId", tenantId.ToString()},
{"isSSORequest", "true"},
{"userEmailId", userNameOrEmail },
{"returnUrl", ssoResult.RelayState }
};
Logger.Info("Redirect starts to: " + ssoResult.RelayState);
return Redirect(QueryHelpers.AddQueryString(ssoResult.RelayState, queryParams));
}
else
{
Logger.Info("Redirect starts to (else Block): " + ssoResult.RelayState);
return Redirect(ssoResult.RelayState);
}
}
}
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
I try to create user from backend with code automatically - and assign to default role.
Is this correkt like this?
Thanks for a hint - currently it seems not working. ( result = await _userManager.SetRolesAsync(user, role);)
//get Employee role value for existing & create new if not existing
IQueryable<Role> query = _roleManager.Roles;
Role roleExists = GetRole(query);
string roleName="";
if (roleExists != null)
{
try
{
roleName = query.ToList().FirstOrDefault(x => x.IsDefault == true).Name;
Logger.Info("roleName = query.ToList().FirstOrDefault(x => x.IsDefault == true).Name");
}
catch(Exception ex)
{
Logger.Error(ex.Message.ToString());
}
}
else
{
Role newRole = new Role(tenantId, "Employee") { IsDefault = false, Name = "Employee" };
CheckErrors(await _roleManager.CreateAsync(newRole));
await CurrentUnitOfWork.SaveChangesAsync();
roleExists = GetRole(query);
roleName = roleExists.Name;
Logger.Info("Role newRole = new Role(tenantId");
}
string[] role = new string[] { roleName };
result = await _userManager.SetRolesAsync(user, role);
Logger.Info("await _userManager.SetRolesAsync(user, role)");
if (!result.Succeeded)
{
throw new UserFriendlyException(L("UserRollNotAssigned"));
}
Please answer the following questions before submitting an issue. YOU MAY DELETE THE PREREQUISITES SECTION.
I try to publish the angular and wep api porject in two separate virtuell diretories instead own websites - is this possible - currently I don't get it up and running. The api .NET CORE throws http error 404 - not found
Any idea?
Page not found" error when I'm following the link on GitHub https://github.com/aspnetzero/aspnet-zero-core
I got here "Page not found" error when I'm following the link on GitHub https://github.com/aspnetzero/aspnet-zero-core