ASP.NET 的通配符映射和 PHP 问题
我有一个用 .NET 3.5 使用 C# 作为语言编写的应用程序。我正在使用 Web 表单,但使用 url 路由以及全局文件中定义的路由。一切都按预期进行。为了使漂亮的路径(请参阅:user/665 而不是 user.aspx?uid=665)正常工作,我必须在 IIS5.1(本地框,而不是测试、登台或生产)中添加通配符映射2.0 框架的 aspnet_isapi 文件。一切正常。
现在,我的网站需要一个 PHP 插件。但是,由于通配符映射,PHP 文件现在由 ASP.NET 提供服务,因此不会由 PHP 解释器处理。有什么办法可以解决这个问题吗?我是否必须向我的 Web 应用程序添加某种处理程序,以接受 ASP.NET 框架处理的所有 PHP 请求并将它们路由到 PHP 引擎?有更简单的方法吗?也许有一种方法可以将它们排除在 web.config (PHP 文件)中并让它们由适当的 PHP 引擎提供服务?
谢谢大家! -史蒂夫
I have an application written in .NET 3.5 with C# as the language. I'm using Web Forms, but using url routing with the routes defined in my global file. Everything is working as expected. In order for the pretty paths (see: user/665 instead of user.aspx?uid=665) to work properly, I had to add a wildcard mapping in IIS5.1 (local box, not test, staging, or production) the aspnet_isapi file for the 2.0 framework. Everything works fine.
Now, my site needs a plugin for PHP. However, the PHP files are now being serviced by ASP.NET due to the wild card mapping, and hence are not processed by the PHP interpretter. Is there any way to get around this? Would I have to add some sort of handler to my web app that will take all PHP requests being handled by the ASP.NET framework and have them routed to the PHP engine? Is there an easier way? Maybe a way to exclude them in the web.config (PHP files) and have them served by the proper PHP engine?
Thanks all!
-Steve
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是一个解决方案,但不是一个优雅的方法(恕我直言):
这对我的情况来说就像一个魅力。但是,有什么办法可以不必处理虚拟目录呢?
This is a solution, but is not an elegant way (IMHO):
This works like a charm for my situation. However, is there any way to not have to deal with virtual directories?
问题是PHP扩展需要注册。
The problem is that the PHP extension needs to be registered.
据我所知,问题在于 ASP.NET 正在尝试路由您的 PHP 请求,因此我要做的就是将 StopRoutingHandler() 添加到 global.asax 中的路由中。像这样的东西应该有效:
编辑:请注意路线是按顺序处理的,所以我会将其添加到路线的顶部。
From what I gather, the problem is that ASP.NET is attempting to route your PHP requests, so what I would do is add a StopRoutingHandler() to your routes in the global.asax. Something like this should work:
Edit: Be mindful that routes are processed in order, so I would add this to the top of your routes.