使IIS 7.5 *通的.xml请求asp.net [英] Make IIS 7.5 pass *.xml requests to asp.net

查看:113
本文介绍了使IIS 7.5 *通的.xml请求asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何配置IIS 7.5的所有* .xml文件请求转发到asp.net引擎,所以我可以在Global.asax中处理它们和路径改写为* .aspx文件?现在IIS期望直接找到他们在磁盘上。我会用这个做动态生成的sitemap.xml我


解决方案

您可以通过编辑你的web.config强制静态文件要经过ASP.NET管道:

 < system.webServer>
    <&处理GT;
      <添加名称=XMLHandlerTYPE =System.Web.StaticFileHandler路径=* XML。动词=GET/>
    < /处理器>
< /system.webServer>


  1. HTTP处理程序和HTTP模块概述

  2. 如何:注册HTTP处理程序

How do I configure IIS 7.5 to forward all *.xml file requests to asp.net engines so i can handle them in Global.asax and rewrite the path to a *.aspx file? Now IIS is expecting to find them directly on disk. I will use this do dynamically generate my sitemap.xml

解决方案

You can force static files to go through the ASP.NET pipeline by editing your web.config:

<system.webServer>
    <handlers>
      <add name="XMLHandler" type="System.Web.StaticFileHandler" path="*.xml" verb="GET"  />
    </handlers>
</system.webServer>

  1. HTTP Handlers and HTTP Modules Overview
  2. How to: Register HTTP Handlers

这篇关于使IIS 7.5 *通的.xml请求asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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