Search code examples
iisblazor-webassemblyasp.net-blazorasp.net-core-staticfile

I'm getting an DirectoryNotFoundException error after published an blazor assembly application ASP.NET CORE hosted in IIS


I have in the server-side project a static files' folder to upload images, when I published this project, it gives me this error:

Error I got in IIS

The folder I'm talking about is here:

This is where I have the static files folder

And this is how I'm telling the application that I have a static files folder in the server-side:

       app.UseStaticFiles(new StaticFileOptions
        {
            FileProvider = new PhysicalFileProvider(
            Path.Combine(Directory.GetCurrentDirectory(), "upload")),
            RequestPath = "/upload"
        });

I hope some of you guys can help me.


Solution

  • You just have to create the upload folder by your own in your application folder.