OWIN自静态文件服务器多路由

OWIN self static file server multiple routes

我在我的 Owin 中配置了一个 webApi 和一个静态文件服务器来获取我的应用程序中需要的一些文件。

public void Configuration(IAppBuilder application)
{
   //Other middlewares and configurations
    ....
   application.UseFileServer(new FileServerOptions()
   {
       RequestPath = new PathString("/myPath1/public"),
       FileSystem = new PhysicalFileSystem(m_FolderPathProvider.myPath1FolderPublic)
   });

       // Attribute routing.
            .....
 }

这很有效。我需要的是为另一个路径和另一个不同的物理文件夹声明另一个 FileServer。我害怕的是,如果我以同样的方式做,我将覆盖这个,我将只有一个。那么如何声明第二个文件服务器呢?

谢谢。

AFAICT,您可以 "mount" 不同的文件系统路径到不同的路由,使用您已经在使用的相同重载。

public void Configuration(IAppBuilder application)
{
   //Other middlewares and configurations
    ....
   application.UseFileServer(new FileServerOptions()
   {
       RequestPath = new PathString("/myPath1/public"),
       FileSystem = new PhysicalFileSystem(m_FolderPathProvider.myPath1FolderPublic)
   });

   application.UseFileServer(new FileServerOptions()
   {
       RequestPath = new PathString("/myPath2/public"),
       FileSystem = new PhysicalFileSystem(m_FolderPathProvider.myPath2FolderPublic)
   });

       // Attribute routing.
            .....
 }

如果你想合并它们,我认为 UseFileServer 不可能。

我是不是漏掉了什么?