asp.net core - Serve static files from outside wwwroot - Stack Overflow

When I run my Devops pipeline, it creates the WebApp.zip file for a .NET Core web app on Azure.That fi

When I run my Devops pipeline, it creates the WebApp.zip file for a .NET Core web app on Azure.

That file includes all my content and a wwwroot folder.

When I run the app, I get 404 for files outside the wwwroot folder that is generated in the pipeline. For example a folder called frontendfiles which contains CSS.

I have tried using the StaticFileOptions like this:

StaticFileOptions staticFileoptions = new StaticFileOptions
      {
          FileProvider = new PhysicalFileProvider(
          Path.Combine(env.ContentRootPath, "frontendfiles")),
          RequestPath = "/frontendfiles"
      };
app.UseStaticFiles(staticFileoptions);
app.UseStaticFiles();

When I view the file structure via FTP I can see that the root is wwwroot, then there is another wwwroot inside which is generated by the pipeline.

The frontendfiles folder sits under the root wwwroot folder, but outside the wwwroot sub folder.

I have spent days trying to figure this out without success so hoping someone might point me in the right direction.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744895433a4599667.html

相关推荐

  • asp.net core - Serve static files from outside wwwroot - Stack Overflow

    When I run my Devops pipeline, it creates the WebApp.zip file for a .NET Core web app on Azure.That fi

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信