Base solution for your next web application

Activities of "MellowoodMedical"

Hi ,

I have the set up below for hangfire dashboard authorization on angular and core application. Both are hosted seperatly.


app.UseHangfireDashboard("/hangfire", new DashboardOptions
            {
                Authorization = new[] { new Url.HangfireAuthorizationFilter() }
            });
            app.UseHangfireServer();
            
   The HangfireAuthorizationFilter make use of the [AbpAuthtoken] which is set after login to api directly.
   
    public bool Authorize(DashboardContext context)
        {
            try
            {
                var cookies = context.GetHttpContext().Request.Cookies;
                var token = cookies["Abp.AuthToken"];
                _logger.Info($"hangfire authorization token  {token}");
                JwtSecurityTokenHandler jwtSecurityTokenHandler = new JwtSecurityTokenHandler();
                TokenValidationParameters tokenValidationParameters = new TokenValidationParameters
                {
                    ValidAudience = _configuration.Audience,
                    ValidIssuer = _configuration.Issuer,
                    IssuerSigningKey = _configuration.SecurityKey
                };

                SecurityToken principal;
                var _ = jwtSecurityTokenHandler.ValidateToken(token, tokenValidationParameters, out principal);

                //httpContext.User
                // Allow all authenticated users to see the Dashboard (potentially dangerous).
                return _.Identity.IsAuthenticated && _.IsInRole("Admin");
            }
            catch(Exception ex)
            {
                _logger.Error("Exception on hangfire authorization ", ex);
                return false;
            }
        }
        

Still getting 401 exception on /hangfire. Any thoughts?

Got it working :)

Hi,

How can I access log4net.ThreadContext.Properties in my service class to support custom log4net properties.

Thanks

Thanks a lot, ryancyq. Your solution works. Our second db context is just inherited from AbpDbContext.

Hi,

We have 2 databases and 2 dbContext and each has its own entities. The one which was created by default with aspnetzero works fine with EntityHistory and the one we added as second database is having issues.

thanks

We are using multiple databases for the our project. Now we have created a custom implementation for IEntityHistoryStore and used it to replace the default implementation. Also, we have uncommented lines to write change logs for the entities and added the entity type for Entity History selectors. The problem is that Entity History works for entities stored in the one database and doesn't work for entities stored in another databases. Do you have any suggestions for that?

The version of Asp.net Zero is v6.6.0 and we are using EntityFramework Core.

Hi,

I have added second DbContext to my aspnetzero project and it works fine on my local but as soon as I deploy it to azure it throws following exception:

System.Exception: Could not find content root folder!   at PatientPortal.Web.WebContentDirectoryFinder.CalculateContentRootFolder() in D:\a\1\s\src\PatientPortal.Core\Web\WebContentFolderHelper.cs:line 27   at PatientPortal.EntityFrameworkCore.PatientPortalConnectionStringResolver.GetNameOrConnectionString(ConnectionStringResolveArgs args) in D:\a\1\s\src\PatientPortal.EntityFrameworkCore\EntityFrameworkCore\PatientPortalConnectionStringResolver.cs:line 19   at Abp.Domain.Uow.UnitOfWorkBase.ResolveConnectionString(ConnectionStringResolveArgs args)   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.GetOrCreateDbContext[TDbContext](Nullable`1 multiTenancySide, String name)   at Abp.EntityFrameworkCore.Uow.UnitOfWorkExtensions.GetDbContext[TDbContext](IActiveUnitOfWork unitOfWork, Nullable`1 multiTenancySide, String name)   at Abp.EntityFrameworkCore.Uow.UnitOfWorkDbContextProvider`1.GetDbContext(Nullable`1 multiTenancySide)   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.get_Context()   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.get_Table()   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.GetAllIncluding(Expression`1[] propertySelectors)   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.GetAll()   at Abp.EntityFrameworkCore.Repositories.EfCoreRepositoryBase`3.FirstOrDefaultAsync(TPrimaryKey id)   at Abp.Domain.Repositories.AbpRepositoryBase`2.GetAsync(TPrimaryKey id)   at Abp.Threading.InternalAsyncHelper.AwaitTaskWithPostActionAndFinallyAndGetResult[T](Task`1 actualReturnValue, Func`1 postAction, Action`1 finalAction)   at PatientPortal.Demographic.Service.DemographicService.GetDemograph(Int32 input)   at lambda_method(Closure , Object )   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExec...

Please suggest.

Thanks, Gaurav Singh

Answer

Hi, Sent you email with onedrive link to the above mentioned email.

Question

Hi,

I am trying to unit test plugin service and getting following error:

Castle.MicroKernel.ComponentNotFoundException : No component for supporting the service Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartManager was found

Can you please suggest.

Thanks, Gaurav Singh

Answer

Thanks, tests are running now.

Showing 71 to 80 of 87 entries