在IIS上使用Nancy托管虚拟目录

Cal*_*ass 4 iis-7 nancy

我有一个NancyFx应用程序,我在路径下设置了一个虚拟目录/photos.但是,当我浏览它时,我得到了404.我已经确定权限等..是正确的所以我想知道是否与NancyFx劫持请求并寻找在我的/photos路径下定义的路由有关吗?

Phi*_*ill 6

最简单的方法是告诉IIS不要在/ photo目录中使用Nancy.您可以通过在web.config中添加位置来执行此操作,如下所示:

<location path="photo">
  <system.webServer>
    <handlers>
      <remove name="Nancy"/>
    </handlers>
  </system.webServer>
</location>
Run Code Online (Sandbox Code Playgroud)

文档可以在这里找到:

https://github.com/NancyFx/Nancy/wiki/Managing-static-content#letting-iis-handle-static-content