如何将旧版 ASP 应用程序转换为 ASP.NET?
我们有一个大型 ASP(经典 ASP)应用程序,我们希望将其转换为 .NET,以便开发进一步的版本。 继续使用 ASP 是没有意义的,因为它已经过时了,我们不想从头开始重写它(Joel Spolsky 告诉您 为什么)。
有没有办法自动将其从 ASP 转换为 ASP.NET?
We have a large ASP (classic ASP) application and we would like to convert it to .NET in order to work on further releases. It makes no sense continuing to use ASP as it is obsolete, and we don't want to rewrite it from scratch (Joel Spolsky tells you why).
Is there a way to convert it from ASP to ASP.NET automatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
出色地,
我曾经在一家公司工作,那里的所有 Web 应用程序都是经典的 ASP。
当决定迁移到 .NET 时,我们必须找到一种方法将 168(!) 个 Web 应用程序转换为这个新框架。
我尝试了当时所有可用的工具来做到这一点,但都失败了。
最好的方法是构建一个新的 Web 服务器并从头开始,这样您就可以确保升级会快速进行,并且不会因为新旧集成而出现任何问题。 您将能够选择保留哪些功能和视觉外观以及更改哪些功能和视觉外观。
不要浪费时间在自动工具上将旧的 ASP 文件/站点升级到 NET 平台。 到目前为止,还没有一个能正常工作。
最重要的是,如果后端有数据库,那么从网络应用程序连接到它就会遇到问题。
Well,
I used to work for the company where all web apps were classic ASP.
When decision was made to move to .NET we had to find a way to transform 168(!) web apps into this new framework.
I tried all the tools available at the time to do this and all failed.
Best way is to build a new web server and start there from scratch, this way you can be sure that upgrade will happen fast and will work without any hick-ups because of old-new integration. You will be able to choose what functionality and visual appearances to keep and which one to change.
Do not waste your time on automatic tools to upgrade your old ASP files/sites into NET platform. None so far have ever worked properly.
And on top of that if you have database on back end, you will run into problem with connection to it from web apps.
即使有可以在经典 ASP 和 ASP.NET 之间进行转换的工具,它们也不会产生非常好的结果:这两种环境根本不同。 快速谷歌一下就会出现一些结果,大部分都是“我们会让我们在印度的人来做这件事”之类的。
我的建议是暂时不要触及现有的 ASP 代码。 在可预见的将来,运行时环境将得到 Microsoft 的支持,因此没有迫切需要迁移。 相反,开始开发 ASP.NET 中的新功能:这样,您就不会被遗留概念所阻碍,并且可以以您认为的任何方式使用框架(包括 ASP.NET MVC 等内容)提供的新功能合身。
当然,您的新代码需要与现有的 ASP 环境兼容。 在 ASP 和 ASP.NET 之间共享会话状态很可能是其中之一您的第一个要求,但您很快就会发现更多类似的问题。
此类问题的“正确”解决方案将完全取决于您当前的代码和要求:有时,您可以将 .NET 代码包装在 COM 对象中以供 ASP 代码使用,有时部分移植/迁移可能是解决方案。
然而,平均而言,“两个世界”方法应该是完全可行的,并且允许您开发令人兴奋的新功能,而不必担心遗留代码。
December 2009 addition to original answer: Just came across the ASP Classic Compiler, which is an actively maintained VBscript compiler that converts classic ASP pages into code that runs natively on ASP.NET. It has several cool features, such as the ability to use it as a ASP.NET MVC custom ViewEngine, so despite its beta status, it would definitely seem worth keeping an eye on...
Even if there are tools to convert between classic ASP and ASP.NET, they're not going to generate very good results: the two environments are just too fundamentally different. A quick Google turns up a few results, mostly of the "we'll have our guys in India do it" variety.
My advice would be not to touch your existing ASP code for now. The runtime environment will be supported by Microsoft for the foreseeable future, so there's no urgent need to migrate. Instead, start working on new functionality in ASP.NET: this way, you won't be held back by legacy concepts, and can use the new coolness afforded by the Framework (including stuff like ASP.NET MVC) in any way you see fit.
Of course, your new code will need to work with the existing ASP environment. Sharing session state between ASP and ASP.NET will most likely be one of your first requirements, but you'll soon identify more issues like that.
The 'right' solution for such issues will depend entirely on your current code and requirements: sometimes, you'll be able to wrap .NET code in a COM object for use by your ASP code, sometimes partial porting/migration may be the solution.
However, on average, the 'two worlds' approach should be entirely feasible, and allow you to develop exciting new features without having to worry about your legacy code.
December 2009 addition to original answer: Just came across the ASP Classic Compiler, which is an actively maintained VBscript compiler that converts classic ASP pages into code that runs natively on ASP.NET. It has several cool features, such as the ability to use it as a ASP.NET MVC custom ViewEngine, so despite its beta status, it would definitely seem worth keeping an eye on...
Microsoft 在 MSDN 上发表了一篇文章,讨论迁移 ASP 页面到 ASP.NET。 他们基本上告诉您在计算机/服务器上安装 .net 并一次转换一页。 ASP 和 ASP.NET 可以共存,因此可以随时将每个页面重命名为“aspx”。 但是,您应该注意,会话状态和应用程序状态不在 ASP 和 ASP.NET 页面之间共享(请参阅 @mdb 的答案解决该问题。)
还有ASP 到 ASP.NET 迁移助手,但我不确定该项目/计划是否仍处于活动状态。 您可以通过从此页面下载来尝试:
http:// /www.asp.net/downloads/archived/migration-assistants/asp-to-aspnet/
Microsoft has an article up on MSDN that talks about Migrating ASP Pages to ASP.NET. They basically tell you to install .net on your computer/server and the transform one page at a time. ASP and ASP.NET can co-exist so can can rename each page to "aspx" as you go. You should note, however, that session state and application state are not shared between ASP and ASP.NET pages (See @mdb's answer for a workaround on that problem.)
There is also The ASP to ASP.NET Migration Assistant, but I'm not sure that project/program is still active. You can try it by downloading from this page:
http://www.asp.net/downloads/archived/migration-assistants/asp-to-aspnet/
gmStudio 是一个全面的 VB6/ASP/COM 到 .NET 升级工具。 它可以读取、分析、解释、重写和重构(如 C# 或 VB.NET)单个页面+包含或整个站点。
该技术自 2007 年以来一直在积极开发中,我们已经使用它来帮助我们重写从几百页到数千页的网站。
该工具已在 MSDN 上获得认可。
A(旧)演示视频在 ScreenCast 上。(我真的需要更新这个!在那之前,请让我知道您是否想要现场演示以了解最新内容。)
还有更多内容要讲,请 如果您有兴趣,请联系我们。
免责声明:我为 Great Migrations 工作。
gmStudio is a comprehensive VB6/ASP/COM to .NET upgrade tool. It can read, analyze, interpret, rewrite and restructure (as C# or VB.NET) individual pages+includes or entire sites.
The technology has been in active development since 2007 and we have used it to help us rewrite sites ranging from a few hundred pages to 1000s of pages.
The tool is endorsed on MSDN here.
A (old) demo video is on ScreenCast here. (I really need to update this! Until then, please let me know if you want a live demo to see the latest.)
There is a more lot to tell, please contact us if you are intrested.
Disclaimer: I work for Great Migrations.