Base solution for your next web application

Activities of "cmthomps"

Well, I found a workaround but I'm not sure if it's the appropriate solution.

In the _Layout.cshtml file there is this code:

<script type="text/javascript">
    @* This is used to get the application's root path from javascript.
    It's useful if you're running application in a virtual directory under IIS. *@
    var abp = abp || {}; abp.appPath = '@ApplicationPath';
</script>

If I change it to:

<script type="text/javascript">
    @* This is used to get the application's root path from javascript.
    It's useful if you're running application in a virtual directory under IIS. *@
    var abp = abp || {}; abp.appPath = '@ApplicationPath' + 'aspnetzero/';
</script>

It works.

Question

Do you happen to have an architectural diagram for ASP.NET Zero? Looking for something high level like this. [http://www.reddnet.net/wp-content/uploads/2014/04/ef_domain_model.png])

We're using the MVC .NET Core version and are trying to enable Hangfire. I followed the instructions to enable the hangfire dashboard found at: [https://aspnetboilerplate.com/Pages/Documents/Hangfire-Integration])

When I try to access the dashboard, I get the following error. Any help would be appreciated.

System.ArgumentException: Context argument should be of type `AspNetCoreDashboardContext`!
Parameter name: context
   at Hangfire.Dashboard.AspNetCoreDashboardContextExtensions.GetHttpContext(DashboardContext context)
   at Abp.Hangfire.AbpHangfireAuthorizationFilter.IsLoggedIn(DashboardContext context)
   at Abp.Hangfire.AbpHangfireAuthorizationFilter.Authorize(DashboardContext context)
   at Hangfire.Dashboard.MiddlewareExtensions.<>c__DisplayClass1_1.<UseHangfireDashboard>b__3(IDashboardAuthorizationFilter filter)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at Hangfire.Dashboard.MiddlewareExtensions.<>c__DisplayClass1_2.<UseHangfireDashboard>b__1(IDictionary`2 env)
   at Microsoft.Owin.Mapping.MapMiddleware.&lt;Invoke&gt;d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Owin.Mapping.MapMiddleware.&lt;Invoke&gt;d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Owin.WebSocketAcceptAdapter.&lt;&gt;c__DisplayClass6_0.&lt;&lt;AdaptWebSockets&gt;b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.&lt;Invoke&gt;d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.&lt;Invoke&gt;d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationMiddleware.&lt;Invoke&gt;d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.&lt;Invoke&gt;d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at IdentityServer4.Hosting.IdentityServerMiddleware.&lt;Invoke&gt;d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at IdentityServer4.Hosting.FederatedSignOutMiddleware.&lt;Invoke&gt;d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at IdentityServer4.Hosting.AuthenticationMiddleware.&lt;Invoke&gt;d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.&lt;Invoke&gt;d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at IdentityServer4.Hosting.BaseUrlMiddleware.&lt;Invoke&gt;d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.&lt;Invoke&gt;d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.&lt;Invoke&gt;d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.&lt;Invoke&gt;d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.<Invoke>d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware`1.&lt;Invoke&gt;d__18.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.&lt;Invoke&gt;d__7.MoveNext()

Thanks. I think that is what we're doing. I basically just un-commented the code in the startup class. My configure method is below.

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {
            //Initializes ABP framework.
            app.UseAbp(options =>
            {
                options.UseAbpRequestLocalization = false; //used below: UseAbpRequestLocalization
            });

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseStatusCodePagesWithRedirects("~/Error?statusCode={0}");
                app.UseExceptionHandler("/Error");
            }

            AuthConfigurer.Configure(app, _appConfiguration);

            app.UseStaticFiles();

            app.UseAbpRequestLocalization();

#if FEATURE_SIGNALR
            //Integrate to OWIN
            app.UseAppBuilder(ConfigureOwinServices);
#endif

            //Hangfire dashboard & server (Enable to use Hangfire instead of default job manager)
            app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                Authorization = new[] { new AbpHangfireAuthorizationFilter(AppPermissions.Pages_Administration_HangfireDashboard) }
            });
            app.UseHangfireServer();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "defaultWithArea",
                    template: "{area}/{controller=Home}/{action=Index}/{id?}");

                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            // Enable middleware to serve generated Swagger as a JSON endpoint
            //app.UseSwagger();
            // Enable middleware to serve swagger-ui assets (HTML, JS, CSS etc.)
            //app.UseSwaggerUI(options =>
            //{
            //    options.SwaggerEndpoint("/swagger/v1/swagger.json", "TestCode API V1");
            //}); //URL: /swagger
        }

Sorry. No. That is how my code has been. This is basically a fresh download of aspnetzero. We were testing some of the new functionality (I think it's 4.3) so there is not any custom code yet.

I'm having a similar issue as the one presented at: [https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=9887&p=22368&hilit=notification#p22368])

I've gone through the post and am not having any luck. The users never receive the notifications. I can see that the service is getting called because I can set a breakpoint and I can also see the jobs in the Hangfire tables.

Here is my domain service code. Happy to send the project along if it would be easier.

Thanks, Craig

using Abp;
using Abp.Domain.Repositories;
using Abp.Domain.Uow;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TestCode.TestCode.Authorization.Users;

namespace TestCode.TestCode.Notifications
{
    public class NotificationDomainService : TestCodeDomainServiceBase, INotificationDomainService
    {
        //private readonly INotificationDomainService _notificationDomainService;

        private readonly IAppNotifier _appNotifier;
        private readonly UserManager _userManager;
        private IRepository<User, long> _userRepository;
        private readonly IUnitOfWorkManager _unitOfWorkManager;

        public NotificationDomainService(IAppNotifier appNotifier, IRepository<User, long> userRepository, IUnitOfWorkManager unitOfWorkManager)//, UserManager userManager)
        {
            _appNotifier = appNotifier;
            //_userManager = userManager;
            _userRepository = userRepository;
            _unitOfWorkManager = unitOfWorkManager;
        }

        
        public virtual void NotifyAllForTenantById(int? tenantId, string message = "Domain Service", string severity = "info")
        {
            using (_unitOfWorkManager.Begin())
            {
                using (CurrentUnitOfWork.DisableFilter(AbpDataFilters.MayHaveTenant))
                {
                    var users = _userRepository.GetAllList(u => u.TenantId == tenantId);
                    
                    UserIdentifier[] userIds = new UserIdentifier[users.Count()];
                    int i = 0;
                    foreach (User u in users)
                    {
                        UserIdentifier userId = new UserIdentifier(tenantId, u.Id);
                        _appNotifier.SendMessageAsync(userId, "Hello to All Tenant Users From The Domain Service");
                  }
                  
                    CurrentUnitOfWork.SaveChanges();
                    
                }
            }
        }


    }
}

It does. I've also created a button in my application that fires off a notification (as a test). Those get to the user without an issue.

Thanks Aaron - Still no luck. Any other ideas?

The odd thing is that sometimes the notification goes through the first time the service is hit. After that, the notifications do not go through.

No errors. Consistently, the first time the service runs, the notification gets sent and received. After that, none of the other notifications go through. The hangfire jobs show success. Screenshot attached,

Showing 11 to 20 of 88 entries