I created an asp.net core api that some of the payload accepts images.
These images are stored in wwwroot/image of the application's folder, and the absolute path is stored in the database.
When testing locally, I can access the image from the path and see the image. I finally deployed to the host using Plesk and can no longer get the images.
A sample response carrying returning images:
{
"responseCode": "00",
"responseMessage": "sucessfull",
"response": {
"examinationBodies": [
{
"id": 2,
"name": "Jamb",
"description": "Joint Admission Matriculation Board",
"imageUrl": "C:\\Users\\**********\\source\\repos\\Rikudouensof\\AinsExaminations\\AinsExaminations.Api\\wwwroot\\Images/ExaminationBodies\\Jamb.jpeg"
},
{
"id": 3,
"name": "WAEC",
"description": "The West African Examination Council",
"imageUrl": "https://api.ainsexamination.com\\wwwroot\\Images/ExaminationBodies\\WAEC.jpg"
}
]
}
}
Below are the sample results on a .net maui application
I have gone to Plesk and gone to the folder, I have tried to see if I need to give permission. All permission has been given. still no hope.
Kindly help
Thanks to @iSR5, I found a way to solve it.
Like he commented, the
Ensure you added UseStaticFiles to your app services.
I went to the Program.cs of the API, and added the following line of code;
app.UseStaticFiles();