如何让IIS在我的网站上正确提供.webmanifest文件? [英] How Can I have IIS properly serve .webmanifest files on my web site?

查看:522
本文介绍了如何让IIS在我的网站上正确提供.webmanifest文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网站图标生成器组装了一个软件包,供网站管理员使用,以使图标可用于许多不同的设备.该页面带有一个名为site.manifest的文件,该文件通过网页文档<head>中的以下标记链接到该文件:

The Favicon Generator assembles a package for webmasters to use in order to have icons available for many different devices. The page comes with a file called site.manifest which is linked to via the following tag in the web page's document <head>:

<link rel="manifest" href="site.webmanifest">

根据 Mozilla :"Web应用清单清单文件的目的是在JSON文本文件中提供有关应用程序的信息(例如名称,作者,图标和描述),目的是将Web应用程序安装到设备的主屏幕上,从而为用户提供更快的访问权限和更丰富的体验. "

不幸的是,如果您使用的是Microsoft的Internet信息服务(IIS),则尝试访问site.webmanifest文件会收到404.3错误.

Unfortunately if you are using Microsoft's Internet Information Services (IIS), you'll get a 404.3 error if you try and access the site.webmanifest file.

确切的错误消息如下:由于扩展​​名配置,无法为您请求的页面提供服务.如果该页面是脚本,请添加处理程序.如果应下载文件,请添加MIME.地图."

The exact error message is as follows: "The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map."

如何在IIS中正确提供site.webmanifest文件?

How can I properly serve site.webmanifest files in IIS?

推荐答案

默认情况下,IIS在其(IIS)核心设置中不提供任何未与MIME映射关联的文件.

By default, IIS does not serve any files that does not have a MIME map associated with it in its (IIS) core settings.

为解决这一难题,您将需要将.webmanifest文件扩展名映射到其相应的MIME类型.

To address this challenge, you will need to map the .webmanifest file extension to its appropriate MIME type.

要完成此操作,请打开IIS并按照以下步骤操作;

To accomplish this, open IIS and follow the steps below;

  1. 在左侧,在连接"菜单中选择您的网站或整个服务器. 如果选择服务器,则MIME映射将应用于服务器上的每个网站. 如果您选择一个网站,它将仅适用于单个网站.

  1. On the left hand side, select either your web site or the entire server in the "Connections" menu. If you select the server, your MIME mapping will apply to every web site on the server. If you select a web site, it will only apply to a single web site.

接下来,从IIS菜单中选择"MIME类型":

Next, select "MIME Types" from the IIS menu:

  1. 在该位置,从右侧菜单中单击添加...".

  1. Once there, click "add..." from the right hand menu.

在打开的对话框中,在MIME类型框中的文件扩展名application/manifest+json中指定.webmanifest.

In the dialog box that opens specify .webmanifest in the file name extension box application/manifest+json in the MIME type box.

  1. 单击确定".

恭喜!您刚刚在IIS上为.webmanifest定义了MIME类型.

Congratulations; you've just defined the MIME type for .webmanifest on IIS.

这篇关于如何让IIS在我的网站上正确提供.webmanifest文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆