Microsoft.Owin.StaticFiles在控制台主机中工作,但我在IIS中获得了404文件请求

Tre*_*ack 8 iis static-files owin katana

我在我的Owin管道中设置了Microsoft.Owin.FileServer(v2.1.0),并且使用EnableDirectoryBrowsing = true设置FileServerOptions非常适合在我的控制台主机和iisexpress中显示目录内容.

当我尝试查看特定文件(因此,StaticFiles部分)时,我在iisexpress中遇到了问题.仍然在控制台主机中运行良好,但在iisexpress中我获得了404:

HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

Most likely causes:
- The directory or file specified does not exist on the Web server.
- The URL contains a typographical error.
- A custom filter or module, such as URLScan, restricts access to the file.
Run Code Online (Sandbox Code Playgroud)

我确实在Web主机中引用了最新的Microsoft.Owin.Host.SystemWeb.

Zac*_*ris 19

添加<modules runAllManagedModulesForAllRequests="true">对我不起作用(VS2013,IIS Express).

强制所有请求使用Owin管道:

(在web.config中)

<configuration>
  <system.webServer>
    <handlers>
      <add name="Owin" verb="" path="*" type="Microsoft.Owin.Host.SystemWeb.OwinHttpHandler, Microsoft.Owin.Host.SystemWeb"/>
    </handlers>
  </system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)