.NET How to make Service methods asynchronous?

Generally, things will be asynchronous in the controller class. Now I have a service, which has the DbContext through Dependency Injection. This is how it looks like: public class SomeService : ISomeService { private readonly _context; public SomeService(SomeDbContext context) { _context = context; } public User SomeFunction(int id) { // how to make this async … Read more

ASP.NET Core 3.1 MVC download file not found until IIS app pool recycle or run website from localhost

I am making an ASP.NET Core 3.1 MVC with Entity Framework website on a Microsoft server running IIS 10 with basic user file upload and download functions. I can upload files to the _webHostEnvironment.WebRootPath from the web but when I try to download them it cannot find them. However, if I recycle the app pool I can download the file (I can also download it from the web after accessing the website on localhost on the server).

Most efficient way to save a file on disk while executing async work, on a ASP.Net CORE Web Request

On a request on my Web API, I’m saving a image to the disk and also processing it with an external API which usually takes several seconds. This is a high traffic API, thus I would like to design it in the most efficient way. The image comes in Base64 “encoding”, but this is not pertinent. We can think about it as an arbitrary byte array of 150KB in average (so the saving to disk operation should be really fast).