Search code examples
asp.net-core.net-coreasp.net-core-mvcrepository-patterniformfile

Error when uploading Image to user when registering?


I am trying to upload the profile picture for my user when registering, but the error "An unhandled exception occurred while processing the request" happens, what is this and how can I fix it. I have successfully loaded the image for the Index page, but my Register got the error as shown below. Here is my code

Error Picture enter image description here


Solution

  • The error seems to indicate that you did not register the implementation of IProfileRepository. Please, check if you are doing something like below, in you Startup:

    services.AddScoped<IProfileRepository, ProfileRepository>()
    

    If you are not, I believe that's the cause. The important error message is actually the "Unable to resolve service..." phrase, shown in the image :)