简体   繁体   English

检索.docx文件

[英]Retrieving .docx files

My problem is a simple on, but I haven't found a solution yet. 我的问题很简单,但是我还没有找到解决方案。 I have a folder that contains uploaded resumes stored in pdf, doc, and docx formats. 我有一个文件夹,其中包含以pdf,doc和docx格式存储的上传简历。 The admin backend page shows links to the resumes for each user. 管理员后端页面显示每个用户的简历链接。 If a link to a pdf or doc is clicked the file is downloaded/opened, but if a link to a docx is clicked a 404 error page is shown and if you save the file to your desktop and open word says it is corrupted and cannot be opened. 如果单击指向pdf或doc的链接,则会下载/打开文件,但是如果单击指向docx的链接,则会显示404错误页面,并且如果将文件保存到桌面且打开的单词表示文件已损坏且无法打开。 All files can be opened on the web server. 可以在Web服务器上打开所有文件。

Rather than using code to download files, my links look like: http://www.site.com/test/resume/John_Doe_Resume.docx 我的链接不是使用代码来下载文件,而是像这样: http : //www.site.com/test/resume/John_Doe_Resume.docx

I'm sure there is an easy fix. 我敢肯定有一个简单的解决方法。 Has anyone else run into this problem? 还有其他人遇到这个问题吗?

Make sure .docx has been set up in IIS's list of MIME-types: 确保已在IIS的MIME类型列表中设置了.docx:

Configure MIME Types (IIS 6.0) 配置MIME类型(IIS 6.0)

IIS (7 too for that matter) will give a 404 error if it doesn't know the MIME-type that corresponds to the file extension. 如果IIS(对于该问题也为7),如果它不知道与文件扩展名相对应的MIME类型,则将给出404错误。 If it's not there (and it isn't by default in IIS 6), add .docx with a MIME-type of 如果不存在(默认情况下在IIS 6中也不存在),请添加MIME类型为.docx的.docx。

application/vnd.openxmlformats-officedocument.wordprocessingml.document

I'll bet the framework is treating the .docx extension as a type of executable file; 我敢打赌,该框架将.docx扩展名视为一种可执行文件。 the code or IIS is trying to execute it, which fails. 代码或IIS试图执行它,这将失败。

Check your IIS configuration for file extensions to execute, your web.config and/or your application's routing table, I'll bet the answer is somewhere in there. 检查IIS配置中要执行的文件扩展名,web.config和/或应用程序的路由表,我敢肯定答案就在那儿。

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

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