简体   繁体   English

无法从 ftp 下载 MVC 特定文件

[英]MVC specific files can not download from ftp

In my MVC project I have a file library.在我的 MVC 项目中,我有一个文件库。 There are some files in it which comes from specific folder.其中有一些文件来自特定文件夹。 When I click link to download it, some files couldn't be found, but files are there.当我点击链接下载它时,有些文件找不到,但文件在那里。

For ex: I have two files at content/test.jpg and content/test2.zxd例如:我在content /test.jpg 和content/test2.zxd有两个文件

When I click mywebsite.com/content/test.jpg I can download it, but when I click mywebsite.com/content/test2.zxd I can't download it.当我单击 mywebsite.com/content/test.jpg 时,我可以下载它,但是当我单击 mywebsite.com/content/test2.zxd 时,我无法下载它。

Images, videos, sound files, office files, etc. very known extensions works perfectly, but other file extensions causing problem.图像、视频、声音文件、办公文件等非常知名的扩展名可以完美运行,但其他文件扩展名会导致问题。 How can I solve this?我该如何解决这个问题? Should I have to zip them before upload them?在上传它们之前,我是否必须对它们进行 zip ?

I assume you are using ASP.NET on IIS:我假设您在 IIS 上使用 ASP.NET:
Maybe you have to register unknown static content files for IIS in your web.config with the specific mime type, eg:也许您必须在web.config中使用特定的 mime 类型为 IIS 注册未知的 static 内容文件,例如:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <staticContent>
      <remove fileExtension=".woff2" />
      <mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
      <remove fileExtension=".zxd" />
      <mimeMap fileExtension=".zxd" mimeType="application/octet-stream" />
      <remove fileExtension=".json" />
      <mimeMap fileExtension=".json" mimeType="application/json" />
    </staticContent>
  </system.webServer>
</configuration>

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

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