This is how I've done it:
https://github.com/aspnetzero/aspnet-zero/issues/96#issuecomment-268093697
Hi @maliming,
I had almost exactly the same thing, i was passing Id: instead of id:
Thank you so much!
Hi @maliming - thank you for responding and providing some information, i was looking at the audit logs process aswell.
It looks like the Id is not being passed to the app service when using the code you provided, any suggestions ?
Extra note, when i look at network tab in chrome dev tools i can see that its returned the data, when i debug it passes the param correctly to the appservice and gets expected result back.
I had this problem when i first started, it was because i didnt run yarn / npm bundle. After getting the dependencies and building the solution it worked and the styles appeared.
Hope this helps, reference link below.
https://docs.aspnetzero.com/documents/aspnet-core-mvc/latest/Getting-Started-Core
https://docs.aspnetzero.com/documents/aspnet-core-mvc/latest/Public-Website
for public site, in this link you can also see you need to run the bundles
No problem's, Thanks @ismcagdas
Thanks everyone, issue resolved: was a script import causing issue.
Sorry for wasting time.
Hi @ryancyq,
Below is the information, the ApplicationService that is not working is the basic implementation above just an api method that throws new UserFriendlyException
Version : v7.0.0.0 [20190808] Type: Jquery MVC
ApplicationService 1 : - F12 Developer Tools Console Message 500 (Internal Server Error) No Result Object Response Log File (Not Showing Popup Modal on UI):
WARN 2019-08-09 15:28:44,687 [136 ] Mvc.ExceptionHandling.AbpExceptionFilter - [Already Exists]
Abp.UI.UserFriendlyException: [Already Exists]
at xxx.xxx.xxxAppService.xxx(EntityDto`1 input) in C:\Users\xxxAppService.cs:line 831
at lambda_method(Closure , Object )
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
INFO 2019-08-09 15:28:44,693 [136 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
INFO 2019-08-09 15:28:44,694 [136 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action xxx.Services.xxxAppService.xxx (xxx.Application) in 82.7884ms
INFO 2019-08-09 15:28:44,694 [136 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'xxx.Services.xxxAppService.xxx (xxx.Application)'
INFO 2019-08-09 15:28:44,694 [136 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 103.9412ms 500 application/json; charset=utf-8
Application Service 2: - F12 Developer Tools Console Message 500 (Internal Server Error) Result Object Received with message Log File (Popup showing UI):
WARN 2019-08-09 15:34:25,098 [201 ] Mvc.ExceptionHandling.AbpExceptionFilter - [Already Exists]
Abp.UI.UserFriendlyException: [Already Exists]
at xxx.xxx.xxxAppService.xxx(Int64 xId, Int64 xxId, String code) in C:\xxx\xxxAppService.cs:line 955
at lambda_method(Closure , Object )
at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
INFO 2019-08-09 15:34:25,098 [201 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
INFO 2019-08-09 15:34:25,098 [201 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action xxx.xxx.xxxAppService.xxx (xxx.Application) in 97.0023ms
INFO 2019-08-09 15:34:25,098 [201 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'xxx.xxx.xxx.xxx (xxx.Application)'
INFO 2019-08-09 15:34:25,099 [201 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 155.0018ms 500 application/json; charset=utf-8
Sorry for being unclear, please let me know if this helps clarify
I am trying to throw an exception from AppService
public async Task Example1(EntityDto<long> input)
{
throw new UserFriendlyException(L("AlreadyExists"));
}
called with abp.services.app in a datatable rowAction item
abp.services.app.exampleItems.Example1({ id: data.record.id }).done(function () {
// on done callback
}).always(function () {
// always callback
});
AppService throws error to log file, but does not show alert box on UI.
However another app service throws the same exception and it works, is being called using abp.services.app aswell but it is not in a datatable rowAction.
@demirmusa - thanks, for your assistance the cause was automapper higher up the chain - I added a collection to a dto earlier, forgot about it and automapper just included it. Thank you again.