404 with iis7 asp.mvc doc and pdf files in folder

五迷三道 提交于 2019-12-12 04:36:07

问题


I have got folder "binaries" in my web application. I would like to download pdf and doc (static ontent) files from that direcotory but when i try to get them i have got error 404. I tried to set up static module for *.doc and *.pdf but it not works.


回答1:


StaticFileHandler should work. I had the same problem with *.bz2 files and I have solved it using StaticFileHandler. You can find configuration I used below:

<httpHandlers>
      <remove verb="*" path="*.asmx"/>
      <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
      <add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add verb="*" path="*.bz2" type="System.Web.StaticFileHandler" validate="false" />
</httpHandlers>



回答2:


I converted my directory with binaries (docs, pdf etc.) to application and this resolved my problem with 404 and static files.



来源:https://stackoverflow.com/questions/1543609/404-with-iis7-asp-mvc-doc-and-pdf-files-in-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!