Activities of "Tony_Albutt"

Not to warry

I have implemented my own

Have a good one

Regards Tony

  • ABP Framework version: v5.3.3
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): no
  • Exception message and stack trace: Setting value for 'Abp.Mailing.Smtp.Host' is null or empty!
  • Steps to reproduce the issue:"

Hi

I have run into a small problem when sending SMTP emails from a background job.

I have created a Email reader background job, that is scheduled to process the inbox emails for the tenants IMAP settings using MailKit. This is working well.

One of the functions is for me to send emails, with the attachments.

The only way to do so using Volo.Abp.Emailing, is to use the mailMessage

await _emailSender.SendAsync(mailMessage, true);

For emails without attachments, to use the tenants SMTP email credentials, I need to change the currentTenant

This works for emails, without attachments

                using (_currentTenant.Change(args.TenantId, args.TenantName))
                {
                    await _emailSender.SendAsync(
                        args.EmailAddress,
                        args.Subject,
                        args.Body,
                        args.IsHtml
                    );
                }

However, this does not work when using mailMessage, as suggested in your documentation.

using (_currentTenant.Change(args.TenantId, args.TenantName))
{
	await _emailSender.SendAsync(mailMessage, true)
}

This throws an error

-		$exception	{"Setting value for 'Abp.Mailing.Smtp.Host' is null or empty!"}	Volo.Abp.AbpException
+		Data	{System.Collections.ListDictionaryInternal}	System.Collections.IDictionary {System.Collections.ListDictionaryInternal}
+		InnerException	null	System.Exception
		Source	"Volo.Abp.Emailing"	string
		
		StackTrace	
		   at Volo.Abp.Emailing.EmailSenderConfiguration.<GetNotEmptySettingValueAsync>d__6.MoveNext()
		   at Volo.Abp.Emailing.Smtp.SmtpEmailSender.<BuildClientAsync>d__4.MoveNext()
		   at Volo.Abp.Emailing.Smtp.SmtpEmailSender.<SendEmailAsync>d__5.MoveNext()
		   at Volo.Abp.Emailing.EmailSenderBase.<SendAsync>d__9.MoveNext()
		   at ITX.MailBot.MailBotAppService.<ForwardEmailWithAttachments>d__41.MoveNext() in 
		   C:\Users\antho\source\repos\ITX_New\aspnet-core\src\ITX.Application\MailBot\MailBotAppService.cs:line 412

+		TargetSite	{Void MoveNext()}	System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}

When I remove the _currentTenant.Change(args.TenantId, args.TenantName code, so that I use the default credentials, I get a different error

-		$exception	{"Failure sending mail."}	System.Net.Mail.SmtpException
+		InnerException	{"Cannot access a closed file."}	System.Exception {System.ObjectDisposedException}
		Message	"Failure sending mail."	string
		Source	"Volo.Abp.Emailing"	string
		StackTrace	   
			at Volo.Abp.Emailing.Smtp.SmtpEmailSender.<SendEmailAsync>d__5.MoveNext()
			at Volo.Abp.Emailing.EmailSenderBase.<SendAsync>d__9.MoveNext()
			at ITX.MailBot.MailBotAppService.<ForwardEmailWithAttachments>d__41.MoveNext() 
			in C:\Users\antho\source\repos\ITX_New\aspnet-core\src\ITX.Application\MailBot\MailBotAppService.cs:line 412
+		TargetSite	{Void MoveNext()}	System.Reflection.MethodBase {System.Reflection.RuntimeMethodInfo}

This is my code for forward the email

        private async Task<bool> ForwardEmailWithAttachments(MimeMessage email, string emailAddress, InboxArgs args)
        {
            var message = email;
            var mailMessage = new MailMessage(
                FromEmailAddress,
                emailAddress,
                "FWD: " + email.Subject,
                 email.HtmlBody
                );

            if (email.Attachments.Any())
            {
                foreach (var mailAttachment in message.Attachments)
                {
                    string fileName = mailAttachment.ContentDisposition?.FileName ?? mailAttachment.ContentType.Name;
                    string FileType = Path.GetExtension(fileName);
                    string contentType = "application/" + FileType;
                    var part = (MimePart)mailAttachment;
                    using var stream = System.IO.File.Create(fileName);
                    part.Content.DecodeTo(stream);
                    stream.Position = 0;
                    mailMessage.Attachments.Add(new System.Net.Mail.Attachment(stream, fileName, contentType));
                }
                using (_currentTenant.Change(args.TenantId, args.TenantName))
                {
                    //TODO : TA : 2022-08-24 : The code below throws an error
                    await _emailSender.SendAsync(mailMessage, true);
                }
            }
            return true;
        }

I don't want to change the default SMTP yet and use my own.

Are you able to help?

Thanks and regards Tony

What I found, is that they removed the Volo.CmsKit.Admin.Web.dll from the .web project.

I have tried to re-enable this code that I disabled, and you cant, as the package has been removed

If you create a new project, you will see that the code from this link has been removed. https://support.abp.io/QA/Questions/3301#answer-4c49fc06-f135-0eba-3291-3a04c6eacacf

I don't know if the rest if the CMS kit is working.

Regards Tony

Answer

Mmm, I don't have move, my styling is different too.

Answer

I have been updating my app which was created using ABP suite since version 3.x There may be legacy code relating to CMS that needs to be updated in my project???

The current app does not run when deployed, but runs in debug mode.

To get the app to deploy, I need to disable CMS, probably just the Volo.CmsKit.Pro.Admin.Web which I have done as below.

The only way that I can deploy, is remove reference to the Volo.CmsKit.Pro.Admin.Web.dll in the solutions .web project

  1. remove package .Web.csproj
  2. In the MenuContributor, remobe 2 lines of code using Volo.CmsKit.Pro.Admin.Web.Menus; context.Menu.SetSubItemOrder(CmsKitProAdminMenus.GroupName, 4);
  3. In the WebModule, remove 2 lines of code using Volo.CmsKit.Pro.Admin.Web; typeof(CmsKitProAdminWebModule),

I am fortunate that I am not currently using the CMS, but now I can deploy.

I have got the application running with version 5.3.1 What I have done in addition to the steps above

  1. I have removed the Volo.Abp.Account module source code from the solution - not the problem
  2. I have made all relevant package inclusions to the relevant projects relating to the Volo.Abp.Account.. dll's
  3. *I have removed reference to the PackageReference ="Volo.CmsKit.Pro.Admin.Web", as I am not using it as yet. --This is the problem

from MenuContributor, a. remove using Volo.CmsKit.Pro.Admin.Web.Menus; b. remove context.Menu.SetSubItemOrder(CmsKitProAdminMenus.GroupName, 4);

I can now deploy to the live environment without issues.

**The problem file is Volo.CmsKit.Admin.Web.dll. ** When I re-enable code in file .\aspnet-core\src\project.Web\project.Web.csproj <PackageReference Include="Volo.CmsKit.Pro.Admin.Web" Version="5.3.1" /> ... from the projectMenuContributor : using Volo.CmsKit.Pro.Admin.Web.Menus; context.Menu.SetSubItemOrder(CmsKitProAdminMenus.GroupName, 4); ... from the projectWebModule.cs : using Volo.CmsKit.Pro.Admin.Web; typeof(CmsKitProAdminWebModule), Then the problem is back.

Sturla, I hope that you are not using the CMS public website

OK, still no luck

These are the steps that I followed

Uninstall ABP Suite

dotnet tool uninstall -g volo.abp.suite

Uninstall ABP CLI

dotnet tool uninstall -g volo.abp.cli

Install ABP CLI Version

dotnet tool install -g volo.abp.cli --version 5.3.1

Install ABP Suite version

abp suite install --version 5.3.1

Updated each module to version 5.3.1

Updated main application to version 5.3.1

Updated all projects from <TargetFramework>netstandard2.0</TargetFramework> to <TargetFramework>netstandard2.1</TargetFramework>

Updated all .Contracts projects and added <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> that required it

Updated all .Domain.Shared projects and added <PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" /> that required it

updated all Microsoft.Extensions.FileProviders.Embedded pacages to Version="6.0.5"

updated all Package Reference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect packages to Version="6.0.5

Created new project with same application name and added Public.Web site. Deleted all files in my project for the public CMS website, and replaces with new files.

I am almost ok for now.

I found a local branch of my code using version 5.1.4 that I had not deleted yet. I have uninstalled the ABP cli and suite and installed 5.1.4 then upgraded to 5.2.2 I have re-implemented all me code changes from the 25 commits and have published to the live environment.

I will try some tests to remove the Public CMS website fixes to see what to do to get this working with 5.3.1

Hope that the root cause can be identifies soon.

Best of luck

Hi

I have upgraded from 5.3.0 to 5.3.1 and published

I am getting the same problem, , well almost, encoded page 'qgApoZ2OmDdJqiAoXp5.L4ObZ82mStp54vqoB0A' changed to 'ge8NEZ8y2lBa5les2er.bEPl4e8xKkvM5juVjoG'

If this is an issue using the Public CMS website, how can I remove it, and all referances? Or, should I create a new project with the same project name,and then replace all the public website code?

Below is from the log file.

2022-06-29 21:47:37.024 +02:00 [INF] Starting IdentityServer4 version 4.1.2+997a6cdd643e46cd5762b710c4ddc43574cbec2e
2022-06-29 21:47:37.683 +02:00 [WRN] Savepoints are disabled because Multiple Active Result Sets (MARS) is enabled. If 'SaveChanges' fails, then the transaction cannot be automatically rolled back to a known clean state. Instead, the transaction should be rolled back by the application before retrying 'SaveChanges'. See https://go.microsoft.com/fwlink/?linkid=2149338 for more information. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'.
2022-06-29 21:47:37.724 +02:00 [INF] Using the default authentication scheme Identity.Application for IdentityServer
2022-06-29 21:47:38.306 +02:00 [FTL] Application startup exception
Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module ITX.Web.ITXWebModule, ITX.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: The type 'ge8NEZ8y2lBa5les2er.bEPl4e8xKkvM5juVjoG' is not a valid page. A page must define a public, non-static 'Model' property.. See the inner exception for details.
 ---> System.InvalidOperationException: The type 'ge8NEZ8y2lBa5les2er.bEPl4e8xKkvM5juVjoG' is not a valid page. A page must define a public, non-static 'Model' property.
   at Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultPageApplicationModelProvider.CreateModel(PageActionDescriptor actionDescriptor, TypeInfo pageTypeInfo)
   at Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultPageApplicationModelProvider.OnProvidersExecuting(PageApplicationModelProviderContext context)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.CompiledPageActionDescriptorFactory.CreateCompiledDescriptor(PageActionDescriptor actionDescriptor, CompiledViewDescriptor viewDescriptor)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.CompiledPageActionDescriptorProvider.OnProvidersExecuting(ActionDescriptorProviderContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.UpdateCollection()
   at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.Initialize()
   at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointDataSourceBase.<>c__DisplayClass11_0.<Subscribe>b__0()
   at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
   at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointDataSourceBase.Subscribe()
   at Microsoft.AspNetCore.Mvc.Routing.ControllerActionEndpointDataSource..ctor(ControllerActionEndpointDataSourceIdProvider dataSourceIdProvider, IActionDescriptorCollectionProvider actions, ActionEndpointFactory endpointFactory, OrderedEndpointsSequenceProvider orderSequence)
   at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.GetOrCreateDataSource(IEndpointRouteBuilder endpoints)
   at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllerRoute(IEndpointRouteBuilder endpoints, String name, String pattern, Object defaults, Object constraints, Object dataTokens)
   at Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule.&lt;&gt;c.&lt;ConfigureServices&gt;b__1_10(EndpointRouteBuilderContext endpointContext)
   at Microsoft.AspNetCore.Builder.AbpAspNetCoreApplicationBuilderExtensions.&lt;&gt;c__DisplayClass0_0.&lt;UseConfiguredEndpoints&gt;b__0(IEndpointRouteBuilder endpoints)
   at Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder builder, Action`1 configure)
   at Microsoft.AspNetCore.Builder.AbpAspNetCoreApplicationBuilderExtensions.UseConfiguredEndpoints(IApplicationBuilder app, Action`1 additionalConfigurationAction)
   at ITX.Web.ITXWebModule.OnApplicationInitialization(ApplicationInitializationContext context) in C:\Users\antho\source\repos\ITX_V514\aspnet-core\src\ITX.Web\ITXWebModule.cs:line 456
   at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module)
   at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context)
   --- End of inner exception stack trace ---
   at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context)
   at Volo.Abp.AbpApplicationBase.InitializeModules()
   at Volo.Abp.AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
   at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplication(IApplicationBuilder app)
   at ITX.Web.Startup.Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) in C:\Users\antho\source\repos\ITX_V514\aspnet-core\src\ITX.Web\Startup.cs:line 16
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at ITX.Web.Program.Main(String[] args) in C:\Users\antho\source\repos\ITX_V514\aspnet-core\src\ITX.Web\Program.cs:line 31
2022-06-29 21:47:38.315 +02:00 [FTL] Host terminated unexpectedly!
Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module ITX.Web.ITXWebModule, ITX.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: The type 'ge8NEZ8y2lBa5les2er.bEPl4e8xKkvM5juVjoG' is not a valid page. A page must define a public, non-static 'Model' property.. See the inner exception for details.
 ---> System.InvalidOperationException: The type 'ge8NEZ8y2lBa5les2er.bEPl4e8xKkvM5juVjoG' is not a valid page. A page must define a public, non-static 'Model' property.
   at Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultPageApplicationModelProvider.CreateModel(PageActionDescriptor actionDescriptor, TypeInfo pageTypeInfo)
   at Microsoft.AspNetCore.Mvc.ApplicationModels.DefaultPageApplicationModelProvider.OnProvidersExecuting(PageApplicationModelProviderContext context)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.CompiledPageActionDescriptorFactory.CreateCompiledDescriptor(PageActionDescriptor actionDescriptor, CompiledViewDescriptor viewDescriptor)
   at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.CompiledPageActionDescriptorProvider.OnProvidersExecuting(ActionDescriptorProviderContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.UpdateCollection()
   at Microsoft.AspNetCore.Mvc.Infrastructure.DefaultActionDescriptorCollectionProvider.Initialize()
   at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointDataSourceBase.<>c__DisplayClass11_0.<Subscribe>b__0()
   at Microsoft.Extensions.Primitives.ChangeToken.OnChange(Func`1 changeTokenProducer, Action changeTokenConsumer)
   at Microsoft.AspNetCore.Mvc.Routing.ActionEndpointDataSourceBase.Subscribe()
   at Microsoft.AspNetCore.Mvc.Routing.ControllerActionEndpointDataSource..ctor(ControllerActionEndpointDataSourceIdProvider dataSourceIdProvider, IActionDescriptorCollectionProvider actions, ActionEndpointFactory endpointFactory, OrderedEndpointsSequenceProvider orderSequence)
   at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.GetOrCreateDataSource(IEndpointRouteBuilder endpoints)
   at Microsoft.AspNetCore.Builder.ControllerEndpointRouteBuilderExtensions.MapControllerRoute(IEndpointRouteBuilder endpoints, String name, String pattern, Object defaults, Object constraints, Object dataTokens)
   at Volo.Abp.AspNetCore.Mvc.AbpAspNetCoreMvcModule.&lt;&gt;c.&lt;ConfigureServices&gt;b__1_10(EndpointRouteBuilderContext endpointContext)
   at Microsoft.AspNetCore.Builder.AbpAspNetCoreApplicationBuilderExtensions.&lt;&gt;c__DisplayClass0_0.&lt;UseConfiguredEndpoints&gt;b__0(IEndpointRouteBuilder endpoints)
   at Microsoft.AspNetCore.Builder.EndpointRoutingApplicationBuilderExtensions.UseEndpoints(IApplicationBuilder builder, Action`1 configure)
   at Microsoft.AspNetCore.Builder.AbpAspNetCoreApplicationBuilderExtensions.UseConfiguredEndpoints(IApplicationBuilder app, Action`1 additionalConfigurationAction)
   at ITX.Web.ITXWebModule.OnApplicationInitialization(ApplicationInitializationContext context) in C:\Users\antho\source\repos\ITX_V514\aspnet-core\src\ITX.Web\ITXWebModule.cs:line 456
   at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module)
   at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context)
   --- End of inner exception stack trace ---
   at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context)
   at Volo.Abp.AbpApplicationBase.InitializeModules()
   at Volo.Abp.AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
   at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplication(IApplicationBuilder app)
   at ITX.Web.Startup.Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) in C:\Users\antho\source\repos\ITX_V514\aspnet-core\src\ITX.Web\Startup.cs:line 16
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
   at ITX.Web.Program.Main(String[] args) in C:\Users\antho\source\repos\ITX_V514\aspnet-core\src\ITX.Web\Program.cs:line 31

This did not fix for me

I removed the cms-kit-pro module, but now now get health check errors.

Will wait for 5.3.1

Showing 11 to 20 of 52 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11