查看XML站点地图IIS Express

时间:2014-10-20 11:06:23

标签: asp.net xml iis

尝试查看网站地图时,我尝试使用web.sitemap创建网站地图我已经排序了404.7 server error,允许web.config中的文件扩展名但现在我遇到了允许查看文件类型的问题。该错误告诉我执行以下操作:

To set a MIME type, run the following command in the IIS Express install directory: appcmd set     config /section:staticContent /+[fileExtension='string',mimeType='string']
The variable fileExtension string is the file name extension and the variable mimeType string is the file type description.
For example, to add a MIME map for a file which has the extension ".xyz": appcmd set config /section:staticContent /+[fileExtension='.xyz',mimeType='text/plain']

当我查看文件夹时,我只看到xml配置文件。 有没有办法在web.config中添加MIME类型?或者我必须做IIS的事情吗?

我只允许文件类型:

<fileExtensions allowUnlisted="true">
      <remove fileExtension=".sitemap"/>
      <add fileExtension=".sitemap" allowed="true"/>
</fileExtensions>

1 个答案:

答案 0 :(得分:0)

你也需要mimetype

<staticContent>
  <mimeMap fileExtension=".sitemap" mimeType="application/xml" />
</staticContent>