如何使用.Net处理程序处理.asp扩展? [英] How do I process .asp extensions using the .Net handler?

查看:312
本文介绍了如何使用.Net处理程序处理.asp扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个较旧的经典ASP网站,我正在迁移到IIS7.5。我不想在服务器上安装经典的ASP,所以我只想让.asp文件被视为.aspx文件。



如何做我在IIS7.5中这样做?



编辑:为了澄清,我不是要求如何获得经典的ASP代码在.Net下工作。我只是问如何映射.ASP文件扩展名由.net运行时处理。我将把.asp文件中的代码升级到.net。



编辑:



我放弃了并安装经典的ASP,因为我无法使映射工作(收到404.17和404.3错误的组合)。我标记了David Lively的答案是正确的,因为它是最详细和有用的。

解决方案

/ strong>。 Aspnet_isapi.DLL,它处理执行ASP.NET应用程序,不了解经典的ASP,并将尝试将经典的VBScript代码解析为.NET VBScript。



这是可行的唯一方法是如果您的.ASP页面中没有(而且我的意思是绝对无)经典ASP代码。 / p>

如果是这种情况,您可以将.ASP扩展名映射到IIS管理器中的aspnet_isapi。


  1. 打开inetmgr。

  2. 选择网站

  3. 在功能视图面板中,选择处理程序映射

  4. 将.ASP的映射添加到 C:\Windows \microsoft.net\framework\v2.0.50727\aspnet_isapi.dll (假设您使用的是ASP.NET 2.x)。

同样,如果您的.asp页面中有任何代码,这将导致每个.asp page。



另一个选择是使用重写引擎(我们使用 ISAPI Rewrite )将传入请求的文件扩展名从.asp更改为.aspx。



为什么不想在服务器上安装经典的ASP?它与ASP.NET并行工作很好。



编辑



实际上称为处理程序映射。见上图。


I have an older classic ASP website that I am migrating over to IIS7.5. I don't feel like installing classic ASP on the server, and so I just want the .asp files to be treated as if they were .aspx files.

How do I go about doing this in IIS7.5?

EDIT: To clarify, I am NOT asking how to get classic ASP code to work under .Net. I am just asking how to map the .ASP file extension to be handled by the .net runtime. I will upgrade the code in the .asp files to .net.

EDIT:

I gave up and ended up installing classic ASP, as I couldn't get the mapping to work (received a combination of 404.17 and 404.3 errors). I marked David Lively's answer as correct as it was the most detailed and helpful.

解决方案

That's not going to work. Aspnet_isapi.DLL, which handles executing ASP.NET applications, doesn't understand classic ASP, and will try to parse the classic VBScript code as .NET VBScript.

The only way this is feasible is if you have no (and I mean ABSOLUTELY NONE) classic ASP code in your .ASP pages.

If that is the case, you can map the .ASP extension to aspnet_isapi in IIS manager.

  1. Open inetmgr.
  2. Select the website
  3. In the Feature View panel, select "Handler Mappings"
  4. Add a mapping for .ASP to C:\Windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll (assuming you're using ASP.NET 2.x).

Again, if you have any code in your .asp pages, this will cause a glorious, technicolor failure for every .ASP page.

Another option is to use a rewrite engine (we use ISAPI Rewrite) to change the file extension of incoming requests from from .asp to .aspx.

Why don't you want to install classic ASP on the server? It works just fine in parallel with ASP.NET.

edit

It's actually called "handler mappings." See image above.

这篇关于如何使用.Net处理程序处理.asp扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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