When clicking 'Save' for the 'Change profile picture' dialog an Exception is thrown when .jpg image size is 1.06 MB. Log file details follow:
INFO 2018-03-13 19:31:16,205 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://localhost:22742/Profile/UploadProfilePicture">http://localhost:22742/Profile/UploadProfilePicture</a>
INFO 2018-03-13 19:31:16,205 [3 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful.
INFO 2018-03-13 19:31:16,205 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.2295ms 204
INFO 2018-03-13 19:31:16,213 [8 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 POST <a class="postlink" href="http://localhost:22742/Profile/UploadProfilePicture">http://localhost:22742/Profile/UploadProfilePicture</a> multipart/form-data; boundary=----WebKitFormBoundaryaG2et5LvzCzDF9Cd 1120510
INFO 2018-03-13 19:31:16,213 [8 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful.
INFO 2018-03-13 19:31:16,214 [8 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token.
INFO 2018-03-13 19:31:16,215 [8 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated.
INFO 2018-03-13 19:31:16,219 [8 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful.
INFO 2018-03-13 19:31:16,219 [8 ] uthorization.DefaultAuthorizationService - Authorization was successful for user: admin.
INFO 2018-03-13 19:31:16,220 [8 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method ngTTM.Web.Controllers.ProfileController.UploadProfilePicture (ngTTM.Web.Host) with arguments ((null)) - ModelState is Valid
INFO 2018-03-13 19:31:16,429 [3 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.
INFO 2018-03-13 19:31:16,429 [3 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action ngTTM.Web.Controllers.ProfileController.UploadProfilePicture (ngTTM.Web.Host) in 209.6691ms
INFO 2018-03-13 19:31:16,431 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 217.2792ms 200 application/json; charset=utf-8
INFO 2018-03-13 19:31:16,468 [8 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET <a class="postlink" href="http://localhost:22742/Temp/Downloads/userProfileImage_2.jpg?v=1520994676454">http://localhost:22742/Temp/Downloads/u ... 0994676454</a>
INFO 2018-03-13 19:31:16,468 [8 ] NetCore.StaticFiles.StaticFileMiddleware - Sending file. Request path: '/Temp/Downloads/userProfileImage_2.jpg'. Physical path: 'C:\Users\Tim\Documents__ngTTM\src\ngTTM.Web.Host\wwwroot\Temp\Downloads\userProfileImage_2.jpg'
INFO 2018-03-13 19:31:16,497 [42 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 28.7071ms 200 image/jpeg
INFO 2018-03-13 19:31:42,468 [8 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 OPTIONS <a class="postlink" href="http://localhost:22742/api/services/app/Profile/UpdateProfilePicture">http://localhost:22742/api/services/app ... ilePicture</a>
INFO 2018-03-13 19:31:42,468 [8 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful.
INFO 2018-03-13 19:31:42,468 [8 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 0.4026ms 204
INFO 2018-03-13 19:31:42,495 [3 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 PUT <a class="postlink" href="http://localhost:22742/api/services/app/Profile/UpdateProfilePicture">http://localhost:22742/api/services/app ... ilePicture</a> application/json 76
INFO 2018-03-13 19:31:42,496 [3 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful.
INFO 2018-03-13 19:31:42,537 [3 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token.
INFO 2018-03-13 19:31:42,537 [3 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated.
INFO 2018-03-13 19:31:42,543 [3 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful.
INFO 2018-03-13 19:31:42,549 [3 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method ngTTM.Authorization.Users.Profile.ProfileAppService.UpdateProfilePicture (ngTTM.Application) with arguments (ngTTM.Authorization.Users.Profile.Dto.UpdateProfilePictureInput) - ModelState is Valid
ERROR 2018-03-13 19:31:42,876 [42 ] Mvc.ExceptionHandling.AbpExceptionFilter - Out of memory.
System.OutOfMemoryException: Out of memory.
at System.Drawing.Bitmap.Clone(Rectangle rect, PixelFormat format)
at ngTTM.Authorization.Users.Profile.ProfileAppService.<UpdateProfilePicture>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
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>d__14.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext()
INFO 2018-03-13 19:31:42,877 [42 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext.
INFO 2018-03-13 19:31:42,877 [42 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action ngTTM.Authorization.Users.Profile.ProfileAppService.UpdateProfilePicture (ngTTM.Application) in 333.3698ms
INFO 2018-03-13 19:31:42,877 [42 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 382.3609ms 500 application/json; charset=utf-8
9 Answer(s)
-
0
hi,
set the max image size to 256KB. Open ProfileAppService.cs and set MaxProfilPictureBytes = 262144;
ProfileAppService.MaxProfilPictureBytes = 262144;
-
0
Followed your instruction:
public class ProfileAppService : ngTTMAppServiceBase, IProfileAppService { private const int MaxProfilPictureBytes = 262144; //1048576; //1MB ... }
Still getting exception:
INFO 2018-03-14 01:03:30,404 [3 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2018-03-14 01:03:30,405 [3 ] uthentication.JwtBearer.JwtBearerHandler - Successfully validated the token. INFO 2018-03-14 01:03:30,405 [3 ] uthentication.JwtBearer.JwtBearerHandler - AuthenticationScheme: Bearer was successfully authenticated. INFO 2018-03-14 01:03:30,420 [3 ] pNetCore.Cors.Infrastructure.CorsService - Policy execution successful. INFO 2018-03-14 01:03:30,442 [3 ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method ngTTM.Authorization.Users.Profile.ProfileAppService.UpdateProfilePicture (ngTTM.Application) with arguments (ngTTM.Authorization.Users.Profile.Dto.UpdateProfilePictureInput) - ModelState is Valid ERROR 2018-03-14 01:03:30,950 [27 ] Mvc.ExceptionHandling.AbpExceptionFilter - Out of memory. System.OutOfMemoryException: Out of memory. at System.Drawing.Bitmap.Clone(Rectangle rect, PixelFormat format) at ngTTM.Authorization.Users.Profile.ProfileAppService.<UpdateProfilePicture>d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__12.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- 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>d__14.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.<InvokeNextExceptionFilterAsync>d__23.MoveNext() INFO 2018-03-14 01:03:30,958 [27 ] etCore.Mvc.Internal.ObjectResultExecutor - Executing ObjectResult, writing value Microsoft.AspNetCore.Mvc.ControllerContext. INFO 2018-03-14 01:03:30,959 [27 ] ore.Mvc.Internal.ControllerActionInvoker - Executed action ngTTM.Authorization.Users.Profile.ProfileAppService.UpdateProfilePicture (ngTTM.Application) in 539.3324ms
-
0
I have created an issue here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/issues/919">https://github.com/aspnetzero/aspnet-ze ... issues/919</a>. We will fix it in a short time.
-
0
Better. However, if the selected area touches the right-side of the image, an Exception occurs.
-
0
@TimMackey we have fixed the issue. The fix should work for this case as well. Did you have a chance to try the fix ?
-
0
I did try the fix and I can select almost all of the available area. However, if the selected area includes the right edge of the uploaded image, an Exception still occurs. So, yes, the fix is performing better than before in that I can select a large area, but still causes Exceptions.
Sorry if my previous explanation was too brief.
-
0
-
0
The patch has now been applied correctly. Issue resolved. Thank you.
-
0
@TimMackey thanks a lot :).