Base solution for your next web application
Open Closed

Cant debug server side #8779


User avatar
0
ArturCorreia created

HI

Im getting an error after logging into the app "An internal error occurred during your request!" and when I F12 I see the a 500 status error failed to load resource, pointing to the GetProfilePicture.

I cant even get to debug the ProfileAppService.

Any Ideas?

Thanks


8 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @ArturCorreia,

    Could you open App_Data/Logs/Logs.txt file and send us the error message ? It is under your *.Host project's directory.

  • User Avatar
    0
    ArturCorreia created

    Hi ismcagdas

    Sure, here is some recent logs.

    'EZNow.Authorization.Users.Profile.ProfileAppService' is waiting for the following dependencies:

    • Service 'System.Linq.IQueryable`1[[EZNow.UserDetail.Detail, EZNow.Core, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

    Castle.MicroKernel.Handlers.HandlerException: Can't create component 'EZNow.Authorization.Users.Profile.ProfileAppService' as it has dependencies to be satisfied.

    'EZNow.Authorization.Users.Profile.ProfileAppService' is waiting for the following dependencies:

    • Service 'System.Linq.IQueryable`1[[EZNow.UserDetail.Detail, EZNow.Core, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

      at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency() at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.<CreateControllerFactory>g__CreateController|0(ControllerContext controllerContext) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location where exception was thrown --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) INFO 2020-04-01 18:51:20,743 [20 ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'. INFO 2020-04-01 18:51:20,745 [20 ] c.Infrastructure.ControllerActionInvoker - Executed action EZNow.Authorization.Users.Profile.ProfileAppService.GetCurrentUserProfileForEdit (EZNow.Application) in 7.7031ms INFO 2020-04-01 18:51:20,745 [20 ] ft.AspNetCore.Routing.EndpointMiddleware - Executed endpoint 'EZNow.Authorization.Users.Profile.ProfileAppService.GetCurrentUserProfileForEdit (EZNow.Application)' INFO 2020-04-01 18:51:20,746 [20 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished in 77.7248ms 500 application/json; charset=utf-8 INFO 2020-04-01 18:52:08,545 [22 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/2.0 GET https://localhost:44301/swagger/swagger-ui-bundle.js.map
      INFO 2020-04-01 18:52:08,545 [4 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/2.0 GET https://localhost:44301/swagger/swagger-ui-standalone-preset.js.map
      INFO 2020-04-01 18:52:08,561 [21 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/2.0 GET https://localhost:44301/swagger/swagger-ui.css.map
      INFO 2020-04-01 18:52:08,565 [4 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished in 20.1592ms 404 INFO 2020-04-01 18:52:08,565 [22 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished in 20.6866ms 404 INFO 2020-04-01 18:52:08,579 [21 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request finished in 18.0637ms 404 INFO 2020-04-01 18:52:39,969 [4 ] Microsoft.AspNetCore.Hosting.Diagnostics - Request starting HTTP/2.0 GET https://localhost:44301/api/services/app/Profile/GetProfilePicture
      INFO 2020-04-01 18:52:39,983 [4 ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'EZNow.Authorization.Users.Profile.ProfileAppService.GetProfilePicture (EZNow.Application)' INFO 2020-04-01 18:52:39,986 [4 ] c.Infrastructure.ControllerActionInvoker - Route matched with {area = "app", action = "GetProfilePicture", controller = "Profile"}. Executing controller action with signature System.Threading.Tasks.Task`1[EZNow.Authorization.Users.Profile.Dto.GetProfilePictureOutput] GetProfilePicture() on controller EZNow.Authorization.Users.Profile.ProfileAppService (EZNow.Application). ERROR 2020-04-01 18:52:39,989 [4 ] Mvc.ExceptionHandling.AbpExceptionFilter - Can't create component 'EZNow.Authorization.Users.Profile.ProfileAppService' as it has dependencies to be satisfied.

    'EZNow.Authorization.Users.Profile.ProfileAppService' is waiting for the following dependencies:

    • Service 'System.Linq.IQueryable`1[[EZNow.UserDetail.Detail, EZNow.Core, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

    Castle.MicroKernel.Handlers.HandlerException: Can't create component 'EZNow.Authorization.Users.Profile.ProfileAppService' as it has dependencies to be satisfied.

    'EZNow.Authorization.Users.Profile.ProfileAppService' is waiting for the following dependencies:

    • Service 'System.Linq.IQueryable`1[[EZNow.UserDetail.Detail, EZNow.Core, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.

      at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency() at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden) at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired) at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, Arguments additionalArguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, Arguments arguments, IReleasePolicy policy, Boolean ignoreParentContext) at Castle.MicroKernel.DefaultKernel.Resolve(Type service, Arguments arguments) at Castle.Windsor.MsDependencyInjection.ScopedWindsorServiceProvider.GetServiceInternal(Type serviceType, Boolean isOptional) at Microsoft.AspNetCore.Mvc.Controllers.ServiceBasedControllerActivator.Create(ControllerContext actionContext) at Microsoft.AspNetCore.Mvc.Controllers.ControllerFactoryProvider.<>c__DisplayClass5_0.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Could you share your related AppService code ? I think there is a wrong usage of dependency injection here.

  • User Avatar
    0
    ArturCorreia created

    So i DI these into the service

    private readonly IQueryable<Detail> _userDetailRepository; private readonly IRepository<User, long> _userRepository;

    Used this in the GetCurrentUserProfileForEdit method.

    var query = from u in _userRepository.GetAll() join ud in _userDetailRepository.ToList() on u.Id equals ud.UserId select new { u.UserName, u.Name, u.Surname, ud.JobTitle, ud.LineManagerId, ud.PrefersToBeCalledByName, ud.Title, ud.EmployeeNumber, ud.DateOfBirth, ud.Department, ud.Site, ud.PhoneNumber, ud.MobileNumber, ud.LinkedInProfileURL, ud.TwitterProfileURL, ud.JoinedTheCompanyOnDate, ud.JoinedTheDepartmentOnDate, ud.Hobbies, ud.FavouriteSportsTeam, ud.FavouriteBandsOrMusics, ud.FavouriteArtistsOrMovies, ud.MoreAboutMe, ud.ExternalContactCompanyName, ud.ExternalContactWebsite };

            ObjectMapper.Map(userProfileEditDto, query);
            
            and for the UpdateCurrentUserProfile method i used this.
            
             var query = from u in _userRepository.GetAll()
                        join ud in _userDetailRepository.ToList() on u.Id equals ud.UserId
                        select new
                        {
                            u.UserName,
                            u.Name,
                            u.Surname,
                            ud.JobTitle,
                            ud.LineManagerId,
                            ud.PrefersToBeCalledByName,
                            ud.Title,
                            ud.EmployeeNumber,
                            ud.DateOfBirth,
                            ud.Department,
                            ud.Site,
                            ud.PhoneNumber,
                            ud.MobileNumber,
                            ud.LinkedInProfileURL,
                            ud.TwitterProfileURL,
                            ud.JoinedTheCompanyOnDate,
                            ud.JoinedTheDepartmentOnDate,
                            ud.Hobbies,
                            ud.FavouriteSportsTeam,
                            ud.FavouriteBandsOrMusics,
                            ud.FavouriteArtistsOrMovies,
                            ud.MoreAboutMe,
                            ud.ExternalContactCompanyName,
                            ud.ExternalContactWebsite
                        };
    
    
            ObjectMapper.Map(input, query);
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You need to use IRepository<Detail> instead of IQueryable<Detail>.

  • User Avatar
    0
    ArturCorreia created

    OK changed it and still an error, must be the mapping thats throwing this?

    logs...

    INFO 2020-04-01 20:26:04,054 [4 ] ft.AspNetCore.Routing.EndpointMiddleware - Executing endpoint 'EZNow.Authorization.Users.Profile.ProfileAppService.GetCurrentUserProfileForEdit (EZNow.Application)' INFO 2020-04-01 20:26:04,064 [4 ] c.Infrastructure.ControllerActionInvoker - Route matched with {area = "app", action = "GetCurrentUserProfileForEdit", controller = "Profile"}. Executing controller action with signature System.Threading.Tasks.Task`1[EZNow.Authorization.Users.Profile.Dto.CurrentUserProfileEditDto] GetCurrentUserProfileForEdit() on controller EZNow.Authorization.Users.Profile.ProfileAppService (EZNow.Application). ERROR 2020-04-01 20:26:08,981 [32 ] Mvc.ExceptionHandling.AbpExceptionFilter - Missing type map configuration or unsupported mapping.

    Mapping types: CurrentUserProfileEditDto -> IQueryable1 EZNow.Authorization.Users.Profile.Dto.CurrentUserProfileEditDto -> System.Linq.IQueryable1[[<>f__AnonymousType4`24[[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], EZNow.Application, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]] AutoMapper.AutoMapperMappingException: Missing type map configuration or unsupported mapping.

    Mapping types: CurrentUserProfileEditDto -> IQueryable1 EZNow.Authorization.Users.Profile.Dto.CurrentUserProfileEditDto -> System.Linq.IQueryable1[[<>f__AnonymousType424[[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Int32, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.DateTime, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], EZNow.Application, Version=8.2.0.0, Culture=neutral, PublicKeyToken=null]] at lambda_method(Closure , CurrentUserProfileEditDto , IQueryable1 , ResolutionContext ) at Abp.AutoMapper.AutoMapperObjectMapper.Map[TSource,TDestination](TSource source, TDestination destination) at EZNow.Authorization.Users.Profile.ProfileAppService.GetCurrentUserProfileForEdit() in E:\Projects\EZNow\EZNow-API\src\EZNow.Application\Authorization\Users\Profile\ProfileAppService.cs:line 129 at lambda_method(Closure , Object ) at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult() at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.

  • User Avatar
    0
    ArturCorreia created

    Now got it working.

    I had this being mapped

    ObjectMapper.Map(userProfileEditDto, query);

    rather than

    ObjectMapper.Map(userProfileEditDto, user);

    Thanks for you help as always ismcagdas !!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Great :)