2017-02-22 1 views
1

내 Owin에서 webApi와 정적 파일 서버를 구성하여 응용 프로그램에 필요한 일부 파일을 가져 왔습니다.OWIN 자체 정적 파일 서버 여러 경로

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를 선언하는 것이 필요합니다. 내가 무서운 것은 내가 같은 방식으로 이것을하면 내가 이것을 무시할 것이고 나는 오직 하나만 가질 것이다. 그렇다면 두 번째 파일 서버를 어떻게 선언 할 수 있습니까?

감사합니다.

답변

2

AFAICT를 사용하면 이미 사용중인 동일한 오버로드를 사용하여 다른 경로에 다른 FileSystem 경로를 "탑재"할 수 있습니다.

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로 가능하다고 생각하지 않습니다.

내가 누락 된 항목이 있습니까?

+0

아니, 당신은 뭔가를 그리워하지 않았다, 내 질문은 꽤 바보 같지만 나는이 접근법을 시도하고 일하지 않았다. 다른 솔루션에서이 작업을 시도해 보았 기 때문에 일반적인 해결책에 관한 것이어야합니다. 고마워. :) – acostela