Base solution for your next web application

Activities of "firnas"

Question

When i click on the email confirmation link send when registering a user, sometimes it thorws a error and sometimes it passes. Can i please know why this is hapenning? The error occures when user clicks the activation link from mobile. After retrying sometimes then it passes.

Please see the audit logs,

If i click the link from the computer web application it pasees.

below is the error received,

Can anyone help on understanding why this issue happens?

I have added a new property to User class,

public List<ClaimedPosts> ClaimedPosts { get; set; }

Below is the class for claimed points class


public class ClaimedPosts : FullAuditedEntity<long>
    {
        public long UserId { get; set; }

        public string PostId { get; set; }

        [ForeignKey("UserId")]
        public User User { get; set; }
    }

When i try to save related data to the claimed posts it gives the below error,

Abp.Domain.Uow.AbpDbConcurrencyException
  HResult=0x80131500
  Message=Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
  Source=Abp.EntityFrameworkCore
  StackTrace:
   at Abp.EntityFrameworkCore.AbpDbContext.<SaveChangesAsync>d__49.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.Zero.EntityFrameworkCore.AbpZeroCommonDbContext`3.&lt;SaveChangesAsync&gt;d__98.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.&lt;SaveChangesInDbContextAsync&gt;d__20.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.&lt;SaveChangesAsync&gt;d__12.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.EntityFrameworkCore.Uow.EfCoreUnitOfWork.&lt;CompleteUowAsync&gt;d__14.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.Domain.Uow.UnitOfWorkBase.&lt;CompleteAsync&gt;d__61.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.Domain.Uow.UnitOfWorkInterceptor.&lt;&gt;c__DisplayClass6_0.&lt;&lt;PerformAsyncUow&gt;b__2>d.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.Threading.InternalAsyncHelper.&lt;AwaitTaskWithPostActionAndFinallyAndGetResult&gt;d__5`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.Authorization.Users.AbpUserStore`2.&lt;UpdateAsync&gt;d__36.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Identity.UserManager`1.<UpdateUserAsync>d__174.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.Authorization.Users.AbpUserManager`2.&lt;UpdateAsync&gt;d__52.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at OnePoint.Points.PointsAppService.<SavePointsClaimedPosts>d__5.MoveNext() in D:\SocialRewards2\Trunk\aspnet-core\src\OnePoint.Application\Points\PointsAppService.cs:line 142

Inner Exception 1:
DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.

Hi,

Can i know how to use the settingsmanager in a static method?

AbpSession.UserId is null when running unit tests. Is there a way i can set the user id in the unit test? I am mocking my App service for testing

I have a App service which was working fine earlier. However when i try to invoke a method in the app service now it throws a 500 internal server error. I set a debug point in the method but it is not hitting. I then set a debug point at the constructor level but still even that is not hit.

Is there a place when the error is logged so that i can trouble shoot the issue?

When I run the unit tests i see that the Should_Register unit test in AccountAppService_Tests fails. When troubleshooting the issue as to why it is failing, i figured out that it is failing when trying to send the email avtivation link,

await _userEmailer.SendEmailActivationLinkAsync(user, emailActivationLink);

I see that the IEmailSender is assigned NullEmailSender if in debug mode in the Core module,

if (DebugHelper.IsDebug) { //Disabling email sending in debug mode Configuration.ReplaceService<IEmailSender, NullEmailSender>(DependencyLifeStyle.Transient); }

I have implemented a interface ISendGridEmailSender which sends emails using sendgrid. While debugging i see that sending the activation link uses this service. That why the unit test is failing.

I tried to assign the NullEmailSender to the implemented ISendGridEmailSender as follows,

Configuration.ReplaceService<ISendGridEmailSender, NullEmailSender>(DependencyLifeStyle.Transient);

This gives an error stating that there is no implicit reference conversion between the two. How can I passing the NullEmailSender to the interface i have implemened and get the unit test to pass?

I have a written a background worker to send email notifications to my users periodically using send grid. I followed the following example in your documetation.

https://aspnetboilerplate.com/Pages/Documents/v1.0.0.0/Background-Jobs-And-Workers

I am using the Send Grid nuget package to send emails. The CurrentUnitOfWork becomes null after i call the sendgrids,

await client.SendEmailAsync(message);

method. There for the below line fails in the worker class,

await CurrentUnitOfWork.SaveChangesAsync();

Can you please let me know why this happens and how to overcome this problem.

Thanks, Firnas

We are trying to remove the # from url in MVC angularjs project. Below steps we followed

  1. Add $locationProvider.html5Mode(true); in app.js
  2. Add <base href="/"> in layout.cshtml

After these changes we can able to remove the # from url. Application works fine as SPA. But when reload the page that giving below error.

Server Error in '/' Application The resource cannot be found. HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

To fix this we added below rewrite rule in web.config

<rewrite> <rules> <rule name="Main Rule" stopProcessing="true"> <match url=".*" /> <conditions logicalGrouping="MatchAll"> <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" /> </conditions> <action type="Rewrite" url="/" /> </rule> </rules> </rewrite>

This giving too_many_redirects issue.

To over come from this we added below routing rule in routeConfig.cs

       routes.MapRoute(
       name: "Default",
       url: "{*url}",
       defaults: new { controller = "Home", action = "Index" },
       namespaces: new[] { "NetScribe.Web.Controllers" });

But this also not helping.

Please help with any working methods to achieve this.

I have a asp zero angular 2 project created back in year 2017. No development was done for this project after mid of 2018 and lived in our repo. I downloaded the source code and installed the node modules using yarn. When i run the angular project using npm start i get the below error,

ERROR in Metadata version mismatch for module D:/TactCards/TactCardProject/tact.cards/trunk-sapphire/src/tactcards.Web.Host/node_modules/abp-ng2-module/node_modules/@angular/http/http.d.ts, found version 4, expected 3, resolving symbol ABP_HTTP_PROVIDER in D:/TactCards/TactCardProject/tact.cards/trunk-sapphire/src/tactcards.Web.Host/node_modules/abp-ng2-module/src/abp.module.ts, resolving symbol RootModule in D:/TactCards/TactCardProject/tact.cards/trunk-sapphire/src/tactcards.Web.Host/src/root.module.ts, resolving symbol RootModule in D:/TactCards/TactCardProject/tact.cards/trunk-sapphire/src/tactcards.Web.Host/src/root.module.ts

Can you please let me know why i am getting this error? I googled the error which led me to this linke https://github.com/aspnetboilerplate/module-zero-core-template/issues/141

i changed the @angular/http versiong to 4.3.6 but still the above error occures. Can anyone please help me to resolve this issue?

I have created a xamarin mobile app and it calls the "AbpUserConfiguration/GetAll" to get all settings. How can i add a new setting to this array returned?

Showing 1 to 10 of 17 entries