发布发布在IIS中的托管程序应用程序ASP.NET CORE后,出现DirectoryNotFoundException错误

问题描述

我在服务器端项目中有一个静态文件文件夹来上传图像,当我发布该项目时,它给了我这个错误

Error I got in IIS

我正在谈论的文件在这里

This is where I have the static files folder

这是我告诉应用程序服务器端有一个静态文件文件夹的方式:

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

我希望你们中的一些人能帮助我。

解决方法

您只需要在应用程序文件夹中自己创建upload文件夹即可。