Hi @malming, I'm using the Web.Host project.
If I comment the permission section, I am able to view the hangfire dashboard. But I have no idea how to access the dashboard with the authentication enabled.
I have followed all the steps mentioned in <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Hangfire-Integration">https://aspnetboilerplate.com/Pages/Doc ... ntegration</a> for hangfire integration in .Net Core solution.
When I goto projectUrl/hangfire, I see the error: This page isn’t working If the problem continues, contact the site owner. HTTP ERROR 401
How can I view this page, with Authorization enabled?
<cite>ismcagdas: </cite> @ajayak as far as I remember it depends how you send notification to user. If you directly send notification to user, no need to subscribe but if you send it to a tenant (all users of tenant), then it is send to only subscribed users.
You can read more here <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Notification-System">https://aspnetboilerplate.com/Pages/Doc ... ion-System</a>.
Thanks @ismcagdas. I removed the extra code to subscribe and everything still works great!
Hi @ismcagdas,
I found the cause of the issue. There is an internal error in EF Core 2.1 when using this code for DistinctBy
public static IQueryable<TSource> DistinctBy<TSource, TKey>(this IQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
{
return source.GroupBy(keySelector).Select(x => x.FirstOrDefault());
}
I did manual subscription as follow:
private async Task SubscribeCustomerToNotifications(int customerTenantId, LP lpUser, DateTime agreementEndDate)
{
var customerTenantUserIds = await UserManager.Users.IgnoreQueryFilters()
.Where(c => c.TenantId == customerTenantId && !c.IsDeleted)
.Select(c => c.Id)
.ToListAsync();
foreach (var userId in customerTenantUserIds)
{
await _notificationSubscriptionManager.SubscribeAsync(
new UserIdentifier(customerTenantId, userId), AppNotificationNames.InvoiceGenerated);
}
}
and added notification in AppNotificationsProvider as:
context.Manager.Add(
new NotificationDefinition(
AppNotificationNames.InvoiceGenerated,
displayName: L("InvoiceGenerated"),
permissionDependency: new SimplePermissionDependency(AppPermissions.Pages_PP_SC)
)
);
Is it really required for the manual subscription? I see that this notification works fine without explicit subscription:
context.Manager.Add(
new NotificationDefinition(
AppNotificationNames.InvoicePaid,
displayName: L("InvoicePaid"),
permissionDependency: new SimplePermissionDependency(AppPermissions.Pages_PP_LPA)
)
);
Hi @ismcagdas,
The query worked absolutely fine before the upgrade. I will be fixing this query soon to find the real reason of the exception :)
Note: These issues with aspnet core library updates to 2.1.0
var query = TenantManager.Tenants
.Where(c => !c.isA && !c.IsDeleted)
.Select(c => new E
{
X = c.B
TenancyName = c.TenancyName
})
.WhereIf(!input.Filter.IsNullOrEmpty(), c => c.se.Contains(input.Filter))
.WhereIf(input.CreatedDaysLessThan.HasValue && input.CreatedDaysLessThan > 0, c => c.DaysSinceRegistered <= input.CreatedDaysLessThan)
.WhereIf(input.CreatedDaysMoreThan.HasValue && input.CreatedDaysMoreThan > 0, c => c.DaysSinceRegistered >= input.CreatedDaysMoreThan);
query =
(from q in query
join sc in _scRepository.GetAll()
.Where(c => c.IsTest != input.HasRealData)
.WhereIf(!input.ShowDeleted, c => !c.IsDeleted)
.DefaultIfEmpty()
on q.TenantId equals sc.TenantId
select q).DistinctBy(c => c.TenantId);
var totalCount = await query.CountAsync();
In my code, the join has 0 result and throws an exception on Count.
Mvc.ExceptionHandling.AbpExceptionFilter - Object reference not set to an instance of an object.
System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.EntityFrameworkCore.Query.ExpressionVisitors.Internal.TaskLiftingExpressionVisitor.VisitMember(MemberExpression memberExpression)
at System.Linq.Expressions.MemberExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression node)
at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitMember(MemberExpression node)
at System.Linq.Expressions.MemberExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitMemberAssignment(MemberAssignment node)
at System.Linq.Expressions.ExpressionVisitor.VisitMemberBinding(MemberBinding node)
at System.Linq.Expressions.ExpressionVisitor.Visit[T](ReadOnlyCollection`1 nodes, Func`2 elementVisitor)
at System.Linq.Expressions.ExpressionVisitor.VisitMemberInit(MemberInitExpression node)
at System.Linq.Expressions.MemberInitExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
ERROR 2018-06-14 17:38:38,223 [50 ] ory.Exporting.InventoryReportPdfExporter - The operation was canceled.
System.Threading.Tasks.TaskCanceledException: The operation was canceled. ---> System.IO.IOException: Unable to read data from the transport connection: The I/O operation has been aborted because of either a thread exit or an application request. ---> System.Net.Sockets.SocketException: The I/O operation has been aborted because of either a thread exit or an application request
--- End of inner exception stack trace ---
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error)
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.GetResult(Int16 token)
at System.Net.Http.HttpConnection.FillAsync()
at System.Net.Http.HttpConnection.ReadNextResponseHeaderLineAsync(Boolean foldedHeadersAllowed)
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.InvokeExportAsync[T](NodeInvocationInfo invocationInfo, CancellationToken cancellationToken)
at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.InvokeExportAsync[T](CancellationToken cancellationToken, String moduleName, String exportNameOrNull, Object[] args)
at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.InvokeExportWithPossibleRetryAsync[T](String moduleName, String exportedFunctionName, Object[] args, Boolean allowRetry, CancellationToken cancellationToken)
at PrimePenguin.Technology.DataExporting.Pdf.PdfExporterBase.CreatePdfPackage(String fileName, String title, String[] headers, List`1 body) in D:\PrimePenguin\PrimePenguin.Service\src\PrimePenguin.Technology.Application\DataExporting\Pdf\PdfExporterBase.cs:line 55
WARN 2018-06-14 17:38:38,412 [68 ] Mvc.ExceptionHandling.AbpExceptionFilter - Failed to generate a downloadable PDF. Please contact admin.
Abp.UI.UserFriendlyException: Failed to generate a downloadable PDF. Please contact admin.
at PrimePenguin.Technology.DataExporting.Pdf.PdfExporterBase.CreatePdfPackage(String fileName, String title, String[] headers, List`1 body) in D:\PrimePenguin\PrimePenguin.Service\src\PrimePenguin.Technology.Application\DataExporting\Pdf\PdfExporterBase.cs:line 67
at PrimePenguin.Technology.Reports.Inventory.Exporting.InventoryReportPdfExporter.ExportToFile(List`1 inventoryItemDtos) in D:\PrimePenguin\PrimePenguin.Service\src\PrimePenguin.Technology.Application\Reports\Inventory\Exporting\InventoryReportPdflExporter.cs:line 30
at PrimePenguin.Technology.Reports.Inventory.InventoryReportAppService.GetInventoryListToPdf(GetInventoryListInput input) in D:\PrimePenguin\PrimePenguin.Service\src\PrimePenguin.Technology.Application\Reports\Inventory\InventoryReportAppService.cs:line 115
at lambda_method(Closure , Object )
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
Thanks @ismcagdas :)
@ismcagdas, is it possible to add username autocompletion after entering @?? :D
Hi,
I want to change the default setting "App.UserManagement.AllowSelfRegistration" to false for all the new tenants created on my platform. How can I do that?
Thanks @BBakerMMC