I encountered a problem with the "TargetNotifiers" column with update-database from version 11.2.1 to 11.4.0 on a migration 20220607073405_Add_Mass_Notifications. As that migration only attempted to add that column, I was able to proceed by removing the .cs file for the migration (in <project>.EntityFrameworkCore), rebuilding, and running update-database again.
Seems like this could be a problem for future releases if that migration is left in the release. Should it be removed from the aspnet-zero-core project?
Regarding setting up a session, this turned out to be easy to do with the Use method in IAbpSession:
static async Task Main()
{
Console.WriteLine("Hello, World!");
using (var bootstrapper = AbpBootstrapper.Create<WebJobsModule>())
{
bootstrapper.Initialize();
using (var appService = bootstrapper.IocManager.ResolveAsDisposable<ITraineeAppService>())
{
((Abp.Application.Services.ApplicationService) appService.Object).AbpSession.Use(null, 1);
var traineesAll = await appService.Object.GetAll();
Console.WriteLine("Traineees All Count {0}", traineesAll.Items.Count());
}
Console.WriteLine("Press ENTER to exit...");
Console.ReadLine();
}
}
I'm creating an Azure Webjob to handle overnight updates in a tenant database which I manage with a separate database context from the AspNetZero default/admin database. I've got the basic shell running using the .Migrator project console app as an example.
My goal is to use an Application Service with the update actions to encapsulate all of the database operations. I am calling the application service methods from my console app, and am running into the requirement that an AbpSession needs to be defined.
This problem was due to a local change to FileController.cs to require authentication using [AbpMvcAuthorize] By default, the File controller does not require authentication.
From communications (through [email protected]), I am looking at https://support.aspnetzero.com/QA/Questions/9571/Download-file-with-url-query-string-Auth-error#answer-d9417138-8ccb-839e-3ee7-39f755861c5f. as a means of protecting access.
I am using an angular client with an ASPNET Core webapp. All UI screens and AppService calls work within the angular client app once I login through the angular client login screen. One feature in the application creates an Excel file storing it as a temporary file (using TempFIleCacheManager), then using the FileDownloadService to download the temporary file.
All works on my local development system, however, when deployed to Azure (angular client as static website & aspnet core as azure webapp), everything works withing the angular client screens, but the request to the FileDownloadService reports "302 Not Found" status, redirects to the Account/Login screen, which also reports a "302 Not Found", then goes to a "404 Not Found" error screen.
If I separately login to my aspnet core webapp at https://<hostname>/UI in another browser window, then return to the angular client, the FileDownloadService works as expected, and I can download the Excel file and open it. I encounter similar problems (302 Not Found) if I try to access any URLs directly, with the exception of the "swagger" page, which brings up the list of available endpoints although attempting to use one reports as unauthorized. Is there some configuration missing from my appsettings.json for the deployed aspnet core application or appconfig.json for angular client?
Please advise how I can assure that all calls to the aspnet core web app have correct authorization so this problem can be corrected without a direct login using the https://<hostname>/UI. I've looked at other postings and solutions around a "302 Not Found" error, however, those seem related to custom urls, and I wouldn't expect having to do a custom solution because I am using the FileDownloadService provided within the aspnetzero angular client without modification.
I see the same error if I use one of the built-in features of AspnetZero, such as exporting audit logs to Excel. Similarly, if I login to the aspnet core site directly using "https://<hostname>/UI", the problem is corrected and I can download the audit log.
I'm encountering the same problem. Cannot download either the latest version or previous version of a previous generated project. Tried in both Chrome and Edge browsers.
I've created issue #3481 in Github for this:
https://github.com/aspnetzero/aspnet-zero-core/issues/3481
I am introducing additional Primeng components into my project, and I am encountering circumstances where some of the (customized?) styles for components used in the base AspnetZero project are overriding styles in the component that I'm importing and using. My particular circumstance is that I'm using the PrimeNG Picklist component, and outlines around the two lists are lost, as shown below (Labeled Not Working)
The Chrome dev tools show that the crucial style is overridden by src/assets/primeng/tree/css/primeng.tree.css which is incorporated as global style sheet in the angular.json. When I change nothing but remove and compile with the entry removed from angular.json, then I end up with the expected behavior, shown below. Rather than incorporate these customized css files globally, they should be incorporated into the particular component(s) that are using the PrimeNG component. (it will require using ":head and ::ng-deep" in front of the styles in the component css to propogate them to the PrimeNG component, but that will eliminate the possibility of interference like what I am seeing. Would you consider handling the customized styles for the PrimeNG components used by AspnetZero in this way?
Here is an example of how styles are introduced and propogated to a child component
:host ::ng-deep .ui-picklist .ui-button { display: block; margin-bottom: .25em; padding: 10px; }
At the time I posted, I did not have a ServiceCollectionRegistrar in my test module. I added one that mimics the one provided with the AspnetZero project, and removed the flag I had added to skip the Resolve<ChatUserStateWatcher>, and it works now.
Is there someplace that explains what adding this does in the dependency injection process? I'd like to better understand the dependency injection system in Aspnetzero.
I'm running into an issue with the inclusion of resolution and initialization of ChatUserStateWatcher
in the CoreModule. I am trying to construct tests for services I am adding for my application against a database that I am maintaining as a separate DbContext. As part of this, I have to initialize the EntityFrameworkCore module, which depends on CoreModule. When the system is initializing the CoreModule, I am getting an error in the "PostInitialize()" code when it reaches the "ChatUserStateWatcher"
resolution:
<br>
public override void PostInitialize()
{
IocManager.RegisterIfNot<IChatCommunicator, NullChatCommunicator>();
IocManager.Register<IUserDelegationConfiguration, UserDelegationConfiguration>();
IocManager.Resolve<ChatUserStateWatcher>().Initialize();
IocManager.Resolve<AppTimes>().StartupTime = Clock.Now;
}
Error: <br>
Message:
Castle.MicroKernel.Handlers.HandlerException : Can't create component 'NexusApps.Authorization.Users.UserManager' as it has dependencies to be satisfied.
'NexusApps.Authorization.Users.UserManager' is waiting for the following dependencies:
- Service 'Microsoft.Extensions.Options.IOptions`1[[Microsoft.AspNetCore.Identity.IdentityOptions, Microsoft.Extensions.Identity.Core, Version=3.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]' which was not registered.
- Service 'Microsoft.AspNetCore.Identity.IPasswordHasher`1[[NexusApps.Authorization.Users.User, NexusApps.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
- Service 'System.Collections.Generic.IEnumerable`1[[Microsoft.AspNetCore.Identity.IUserValidator`1[[NexusApps.Authorization.Users.User, NexusApps.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null]], Microsoft.Extensions.Identity.Core, Version=3.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]' which was not registered.
- Service 'System.Collections.Generic.IEnumerable`1[[Microsoft.AspNetCore.Identity.IPasswordValidator`1[[NexusApps.Authorization.Users.User, NexusApps.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null]], Microsoft.Extensions.Identity.Core, Version=3.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]' which was not registered.
- Service 'Microsoft.AspNetCore.Identity.ILookupNormalizer' which was not registered.
- Service 'Microsoft.AspNetCore.Identity.IdentityErrorDescriber' which was not registered.
- Service 'System.IServiceProvider' which was not registered.
- Service 'Microsoft.Extensions.Logging.ILogger`1[[NexusApps.Authorization.Users.UserManager, NexusApps.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
- Service 'NexusApps.Authorization.Roles.RoleManager' which was registered but is also waiting for dependencies.
'NexusApps.Authorization.Roles.RoleManager' is waiting for the following dependencies:
- Service 'System.Collections.Generic.IEnumerable`1[[Microsoft.AspNetCore.Identity.IRoleValidator`1[[NexusApps.Authorization.Roles.Role, NexusApps.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null]], Microsoft.Extensions.Identity.Core, Version=3.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]]' which was not registered.
- Service 'Microsoft.AspNetCore.Identity.ILookupNormalizer' which was not registered.
- Service 'Microsoft.AspNetCore.Identity.IdentityErrorDescriber' which was not registered.
- Service 'Microsoft.Extensions.Logging.ILogger`1[[NexusApps.Authorization.Roles.RoleManager, NexusApps.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
When I skip this statement, my test will run fine, without this error. I introduced a bool property in the <AZNProject>CoreModule.cs that allows me to control skipping this when I'm initialiing my testing module. However, I'm concerned that as I customize the AspNetZero-supplied code, it is going to get more difficult to merge in changes as new versions are released.
Will you add an issue in your development queue to change how the resolution/instantiation of the ChatUserStateWatcher class is managed? It seems to me that it should only be when the ChatService is actually needed. I don't want to have to get the entire AspNetZero schema/services instantiated just to test my added service.