我有一套用经典 ASP 编写的 Web 服务。我想将它们转换为asp.net,但这将是一个漫长的过程。我想一次转换几个函数,并使用某种路由机制来选择请求转到哪个版本(经典 asp 或 asp.net)。
更改用于访问 Web 服务和功能的 URL 是不可能的。
要使用的函数由查询字符串中的参数定义。
看来我无法使用 Server.Transfer 从 asp.net 转到 asp,反之亦然。
有人有建议吗?
I have a set of web services written in classic asp. I want to convert them to asp.net, but this will be a long process. I want to convert a couple functions at a time, and use some sort of routing mechanism to select which version the requests go to (classic asp, or asp.net).
Changing the url used to access the web service and functions is out of the question.
The function to use is defined by a parameter in the querystring.
It seems I cannot use Server.Transfer to go from asp.net to asp or vice-versa.
Anyone have suggestions?
发布评论
评论(3)
如果所有内容都将在同一服务器(IIS 7)中运行,您可以使用 URL 重写来简单地使用正则表达式或映射(表)来执行此操作:
http://www.iis.net/download/URLRewrite
这样您的网址就不需要要进行更改,您不需要任何额外的服务器或额外的“代理软件”,只需极其快速的早期重写(对于熟悉 apache 的人来说,就像 mod_rewrite 一样)。
如果您需要转发到单独的服务器(即您需要反向/转发代理),您最好的选择是使用应用程序请求路由 (http://www.iis.net/download/ApplicationRequestRouting)实际上使用 URL 重写功能来拥有非常灵活的路由机制,并具有极高的性能以及内核模式缓存和磁盘等高级功能缓存。
If everything is going to run in the same server (IIS 7) you can use URL Rewrite to simply use regular expressions or a map (table) to do that:
http://www.iis.net/download/URLRewrite
This way your URLs will not need to change, you will not need any extra servers or additional "proxy software", just extremely fast early rewriting (for those familiar with apache, is like mod_rewrite).
If you need to FW to a separate server (ie you need a reverse/forward proxy) your best option is to use Application REquest Routing (http://www.iis.net/download/ApplicationRequestRouting) which actually uses URL rewrite capabilities to have very flexible routing mechanisms, and with extreme performance, and advanced features like kernel mode caching and disk caching.
不确定,但您是否考虑过某种代理服务器(apache mod proxy 或 squid 等)将一个 url 上的请求重新路由到可能位于不同的服务器?您应该能够配置代理以将一个或多个服务调用重定向到同一或不同服务器上的 asp 或 asp.net 实现。
享受!
Not sure but have you considered some sort of proxy server (apache mod proxy or squid etc) to re-route a request at one url to a different url possibly on a different server? You should be able to configure the proxy to redirect one or many of your service calls to either asp or asp.net implementations on the same or different servers.
Enjoy!
您可以创建一个包装 Web 服务。
使用新的命名空间编译当前的经典 ASP(以及您希望转换为的 ASP.NET Web 服务)。假设您当前的 asp Web 服务名为“MyWebService”...将其编译为 MyWebServiceAspClassic,并将新转换的 Web 服务编译为“MyWebServiceAspNet”。
使用上面提到的当前 URL 编译一个全新的 Web 服务 (MyWebServiceWrapper)。然后,在包装器 WebService 中引用 2 个新编译的 MyWebService。然后,您可以使用 QueryString 参数来决定使用哪个引用的 Web 服务。哇!有道理吗?
You could create a wrapper Web Service.
Compile your current classic asp (and the asp.net web service you wish to convert to) using new namespaces. Say your current asp web service is called "MyWebService"...compile it into MyWebServiceAspClassic and the newly converted web service into "MyWebServiceAspNet".
Compile a completely new Web Service (MyWebServiceWrapper) using the current URL you mention above. Then, reference the 2 newly compiled MyWebService's in your wrapper WebService. Then you can use the QueryString parameter to decide which referenced web service to use. Whew! Make sense?