Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "alwefaq"

I am currently using aspnetzero, and inside the solution, i have created an ASP .Net Core Web API. I created several API's that consumes the Application Services in the Web Application (ASPNetZero). The way i consume is through Http calls. My issues here is that if an AppService i am consuming throws a UserFriendlyException, its not returend, and i am always getting "Call failed with status code 500 (Internal Server Error)".

I tried using Postman, and when i call the AppService directly, it returns the frinedly error message, but if i make a call throgugh the Web API, it returns the same error "Call failed with status code 500 (Internal Server Error)". I tried in the startup, in the HostModule, to set the "Configuration.Modules.AbpWebCommon().SendAllExceptionsToClients = true", but this didn't solve the issue.

Can you point on how to be propagate business excpetions from the AppServices throught Web API's?

Hi @maliming, i did send the project to you at [email protected] again, please check it, find reproduce steps below:-

1- Open DateTimeIssueProject.sln 2- Run DateTimeIssueProject.Migrator 3- Run DateTimeIssueProject.Web.Host 4- Run Angular Project 5- Go to http://localhost:4200/account/register 6- Fill required info and click submit 7- Debug Register method in** AccountAppService** 8- Check FirstDateTime and SecondDateTime from RegisterInput dto

** note that the values are provided from register.component.ts and both are set to moment("2014-02-27T10:00:00")

Hi @ismcagdas

a sample project contains the issue already has been sent to you before , you can find it here

https://support.aspnetzero.com/QA/Questions/8963#answer-d97287ad-bfec-df6d-ab05-39f517bc2e47

would you check it again and let me know if it works with you or not.

Thanks

Reminder please .. please let us know if this is a unkoun issue and has no solution from your side so we can find another way to solve it.

any updates here please?

I am sorry here , I was mistaken , the last provided solution did not work for me, still I am getting notmalized datetime on the server. Any other suggestion please ?

Hi, i tried your first solution but it didn't work,

this could be because I have an older version for the UI.

Hi @ismcagdas, This works prefectly, Thanks. Can you please explain why this works if you don't mind?

No error message, it just does not work.

Hi, I got a the latest demo for testing and it worked fine, but for some reason adding the changes to my project didn't fix the issue. please note that the angular version from the demo is Angular CLI: 9.1.0 Node: 12.13.0 OS: win32 x64 Angular: 9.1.0

and for my project is: Angular CLI: 6.2.3 Node: 12.13.0 OS: win32 x64 Angular: 6.1.7

The changes as below:

// AppPreBootstrap private static getUserConfiguration(callback: () => void): any { //... AppPreBootstrap.configureMoment(); //... }

private static configureMoment() { moment.locale(new LocaleMappingService().map('moment', abp.localization.currentLanguage.name)); (window as any).moment.locale(new LocaleMappingService().map('moment', abp.localization.currentLanguage.name)); if (abp.clock.provider.supportsMultipleTimezone) { moment.tz.setDefault(abp.timing.timeZoneInfo.iana.timeZoneId); (window as any).moment.tz.setDefault(abp.timing.timeZoneInfo.iana.timeZoneId); } else { moment.fn.toJSON = function () { return this.locale('en').format(); }; moment.fn.toISOString = function () { return this.locale('en').format(); }; } }

// add LocaleMappingService import { AppConsts } from '@shared/AppConsts'; import * as _ from 'lodash';

export class LocaleMappingService { map(mappingSource: string, locale: string): string { if (!AppConsts.localeMappings && !AppConsts.localeMappings[mappingSource]) { return locale; }

const localeMappings = _.filter(AppConsts.localeMappings[mappingSource], { from: locale }); if (localeMappings && localeMappings.length) { return localeMappings[0]['to']; }

return locale; } }

Showing 1 to 10 of 24 entries