我正在运行一个经典的 ASP 网站,我的在线用户可以在其中将文件附加到内部消息系统。但是每当他们上传文件扩展名超过 3 个字符的附件时,服务器都会给我一个 404。
像 mypicture.jpg
这样的文件工作正常,但是像 mydocument.docx
这样的文件不工作?
有什么建议吗?
最佳答案
IIS6 将仅提供文件扩展名映射到服务器或站点的 mime 映射属性中的 mime 类型的文档。为了提供更新的 Office 2007 文档类型,您需要添加额外的映射。
您可以在许多地方找到这些新 MIME 类型的列表。
这是一个简单的;来自 Office 2007 mime types for IIS :
.docm,application/vnd.ms-word.document.macroEnabled.12 .docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document .dotm,application/vnd.ms-word.template.macroEnabled.12 .dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template .potm,application/vnd.ms-powerpoint.template.macroEnabled.12 .potx,application/vnd.openxmlformats-officedocument.presentationml.template .ppam,application/vnd.ms-powerpoint.addin.macroEnabled.12 .ppsm,application/vnd.ms-powerpoint.slideshow.macroEnabled.12 .ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow .pptm,application/vnd.ms-powerpoint.presentation.macroEnabled.12 .pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation .xlam,application/vnd.ms-excel.addin.macroEnabled.12 .xlsb,application/vnd.ms-excel.sheet.binary.macroEnabled.12 .xlsm,application/vnd.ms-excel.sheet.macroEnabled.12 .xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet .xltm,application/vnd.ms-excel.template.macroEnabled.12 .xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template
Adding all mime-types to IIS in one step is very simple:
The easiest way to do this is stopping IIS and editing the metabase XML file (
C:\WINDOWS\system32\inetsrv\MetaBase.xml
) using a text editor. Search for the<IIsMimeMap Location="/LM/MimeMap" />
element and append the lines above to the MimeMap attribute
关于asp-classic - 经典 ASP 的文件扩展名问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1849441/