简体   繁体   English

.PDF文件的IIS 7.5 404错误

[英]IIS 7.5 404 Error for .PDF files

I am running into an issue where I am re-directing a .pdf extension url using IIS 7.5. 我遇到了使用IIS 7.5重定向.pdf扩展名网址的问题。 Here is what is weird happening: When my URL does not contains .pdf in it like: http://mySite/documents/forms/test the pdf (test.pdf) opens up perfectly. 这是奇怪的事情:当我的URL中不包含.pdf时,例如: http://mySite/documents/forms/test pdf(test.pdf)会完美打开。 However, when I am opening through like this: http://mySite/documents/forms/test.pdf it is showing me 但是,当我这样打开时: http://mySite/documents/forms/test.pdf它向我显示

HTTP Error 404.0 - Not Found

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. 您要查找的资源已被删除,名称已更改或暂时不可用。

I browse through couple of links like: http://chentiangemalc.wordpress.com/2012/02/16/case-of-the-disappearing-pdf/ 我浏览了几个链接,例如: http : //chentiangemalc.wordpress.com/2012/02/16/case-of-the-disappearing-pdf/

and

http://support.microsoft.com/kb/979543 http://support.microsoft.com/kb/979543

But dont know whether they are appropriate. 但是不知道它们是否合适。 Also tried debugging through fiddler as this link mentioned: http://chentiangemalc.wordpress.com/2012/02/16/case-of-the-disappearing-pdf/ 还尝试通过提琴手进行调试,如该链接所述: http : //chentiangemalc.wordpress.com/2012/02/16/case-of-the-disappearing-pdf/

When I am saving the Response Body the pdf file does not get saved in correct format. 当我保存响应正文时 ,pdf文件不会以正确的格式保存。 So I am guessing there is some kind of file corruption? 所以我猜有某种文件损坏吗? Maybe? 也许? But my file opens up perfectly when I do not include the .pdf in the URL. 但是,当我不在URL中包含.pdf时,我的文件可以完美打开。 Dont know what is going on :\\ 不知道发生了什么事:\\

I got the answer. 我得到了答案。 I have to change the web.config file to allow .pdf file to open in the browser: 我必须更改web.config文件以允许.pdf文件在浏览器中打开:

 <preprocessRequest help="Processors should derive from Sitecore.Pipelines.PreprocessRequest.PreprocessRequestProcessor">
    <processor type="Sitecore.Pipelines.PreprocessRequest.SuppressFormValidation, Sitecore.Kernel" />
    <processor type="Sitecore.Pipelines.PreprocessRequest.NormalizeRawUrl, Sitecore.Kernel" />
    <processor type="Sitecore.Pipelines.PreprocessRequest.IIS404Handler, Sitecore.Kernel" />
    <processor type="Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel">
      <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx, pdf</param>
      <param desc="Blocked extensions (comma separated)">*</param>
      <param desc="Blocked extensions that stream files (comma separated)">*</param>
      <param desc="Blocked extensions that do not stream files (comma separated)" />
    </processor>
    <processor type="Sitecore.Pipelines.PreprocessRequest.StripLanguage, Sitecore.Kernel" />
  </preprocessRequest>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM