Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Not able to change the profile picture after deploying in Azure App Service Linux . #8635


User avatar
0
rajamannar created

I published the application in Azure Linux App Service ( Not Docker or Linux VM). I am getting the below error and as a result of this I am not able to change the profile picture.

2020-03-05 10:00:48,468 [22 ] e.Diagnostics.ExceptionHandlerMiddleware - An unhandled exception has occurred while executing the request. System.IO.FileNotFoundException: Could not find file: Common\Images\default-profile-picture.png File name: 'Common\Images\default-profile-picture.png'

I checked in the root directory : The file is present.

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

    Hi @rajamannar

    Does that work on your local computer (Windows) ?

  • User Avatar
    0
    rajamannar created

    Yes. It works on my local computer

  • User Avatar
    0
    rajamannar created

    Hi,

    These are steps to follow to re-create the issue.

    1. Create an Azure App Service and choose .NET Core 3.1 ( LTS ) and it defaults to Linux version.
    2. Then deploy to the newly created App Service from Visual Studio or CI.
    3. As soonn as login the default picture for the admin account will empty
    4. Check in the logs, there will be an error related to this
    5. Additionally you will also find the libgdiplus erro as well. That can be fixed. I have already answered in a separate thread.
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Could you share the exact error message about libgdiplus ?

  • User Avatar
    0
    rajamannar created

    2020-03-05 10:02:10,464 [25 ] Mvc.ExceptionHandling.AbpExceptionFilter - The type initializer for 'Gdip' threw an exception. System.TypeInitializationException: The type initializer for 'Gdip' threw an exception. ---> System.DllNotFoundException: Unable to load shared library 'libgdiplus' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibgdiplus: cannot open shared object file: No such file or directory at System.Drawing.SafeNativeMethods.Gdip.GdiplusStartup(IntPtr& token, StartupInput& input, StartupOutput& output) at System.Drawing.SafeNativeMethods.Gdip..cctor() --- End of inner exception stack trace --- at System.Drawing.SafeNativeMethods.Gdip.GdipLoadImageFromDelegate_linux(StreamGetHeaderDelegate getHeader, StreamGetBytesDelegate getBytes, StreamPutBytesDelegate putBytes, StreamSeekDelegate doSeek, StreamCloseDelegate close, StreamSizeDelegate size, IntPtr& image) at System.Drawing.Image.InitializeFromStream(Stream stream) at System.Drawing.Image.LoadFromStream(Stream stream, Boolean keepAlive) at System.Drawing.Image.FromStream(Stream stream)

    at lambda_method(Closure , Object , Object[] ) at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() --- End of stack trace from previous location where exception was thrown ---

  • User Avatar
    0
    maliming created
    Support Team

    hi rajamannar

    You have solved the problem, right?

    Finally I fixed the problem of missing libgdiplus issue in Azure Linux App Service .

    https://support.aspnetzero.com/QA/Questions/8629

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @maliming :)

  • User Avatar
    0
    rajamannar created

    Hi,

    This problem still exists. Even after installing libgdiplus.

  • User Avatar
    0
    rajamannar created

  • User Avatar
    0
    ismcagdas created
    Support Team

    @rajamannar

    Did you contact with Azure about this ? It seems like the libgdiplus installation must be done in a different way. I think they can help you about this.

  • User Avatar
    0
    rajamannar created

    Ok. I will make contact with them. Once I get a reply. I will update here.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Thanks @rajamannar

  • User Avatar
    0
    Ricavir created

    Hi,

    I plan to switch an existing app on azure app service windows to azure app service linux. Did you solved this issue ?

  • User Avatar
    0
    rajamannar created

    This problem still exists. I followed all the recommendations.

  • User Avatar
    0
    Ricavir created

    Tks for your feedback, @rajamannar.

    @ismcagdas : have you has more information about this limitation on azure app service with linux ? And do you know about other impacts on linux ?

  • User Avatar
    0
    rajamannar created

    I am not able open the image clipping tool.

  • User Avatar
    0
    maliming created
    Support Team

    hi @rajamannar

    In zero 8.4 we replaced EPPlus with NPOI. You can download a demo and try again.

    The core of the problem is to use System.Drawing.Common in linux.

    How to use NPOI on Linux.

    Since NPOI uses System.Drawing.Common, you must install libgdiplus and libc6 on Linux system.

    Ubuntu 16.04 and above

    apt-get install libgdiplus libc6-dev
    ln -s /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
    
    RUN apt-get update \
        && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
            libgdiplus \
        && rm -rf /var/lib/apt/lists/* \
        && ln -sf /usr/lib/libgdiplus.so /usr/lib/gdiplus.dll
    

    https://www.hanselman.com/blog/HowDoYouUseSystemDrawingInNETCore.aspx