2014-07-17 1 views
0

사용자 지정 루트 경로의 구성은 꽤 곧장 앞으로 보인다 같은 https://github.com/NancyFx/Nancy/wiki/The-root-path낸시 - 사용자 지정 루트 경로 - 셀프 호스팅 - 모노/리눅스

내 부트 스트 래퍼와 루트 경로 제공 모양 :

using System; 
using Nancy; 
using Nancy.TinyIoc; 

namespace Marquee.WebUI 
{ 
    public class Bootstrapper : DefaultNancyBootstrapper 
    { 
     protected override void ApplicationStartup(TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines) { 

      base.ApplicationStartup(container, pipelines); 

      StaticConfiguration.DisableErrorTraces = false; 
     } 

     protected override IRootPathProvider RootPathProvider { 

      get { return new CustomRootPathProvider(); } 
     } 
    } 

using System; 
using Nancy; 

namespace Marquee.WebUI 
{ 
    public class CustomRootPathProvider : IRootPathProvider 
    { 
     private readonly string _rootPath = System.Environment.CurrentDirectory; 

     public string GetRootPath() { 

      return _rootPath; 
     } 
    } 
} 

내 리소스는 모두 포스트 빌드가 필요한 곳입니다. {System.Environment.CurrentDirectory} /css/bootstrap.min.css, 나는 CustomRootPathProvider가 호출되고 있다는 것을 확인하기 위해 시작을 디버깅했지만 아직 http : // {localhost}에 대해 404를 얻었습니다 : 1234/css/bootstrap.min .css

답변

0

밝혀졌습니다. 정적 컨텐츠를 루트 아래의 'Content'폴더에 넣기 만하면됩니다. 나는 문서에서 이것을 놓쳤다. 나는 잘 모른다.

관련 문제