路由IIS6上有小数在路线 [英] Routing on IIS6 With Decimal In Route

查看:132
本文介绍了路由IIS6上有小数在路线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个路径在我的MVC3项目,通过调试,并通过IIS7运行时在本地工作完全正常。然而,我们的服务器是IIS6,当我将我的应用程序了,我得到一个该页无法显示的错误。我的猜测是它做的路线小数。

I have a route in my MVC3 project that works perfectly fine locally when run through the debugger and through IIS7. However, our servers are IIS6 and when I move my application out I am getting a "The page cannot be found" error. My guess is it has to do with the decimal in the route..

所以,我曾尝试推行RouteHandler这似乎越来越调用,但不能正常工作,因为该值是不是在路由覆盖?

So I have tried implementing a RouteHandler which seems to be getting called but is not working correctly because the value isn't overwritten in the route?

总之,这里是我的路线:

Anyway, here is my route:

var route = context.MapRoute(
    "Management_version",
    "Management/Version/{versionNumber}/{action}",
    new { area = "Management", controller = "Version", action = "View" },
    new[] { "FRSDashboard.Web.Areas.Management.Controllers" }
);
route.RouteHandler = new HyphenatedRouteHandler();

和我的路由处理:

public class HyphenatedRouteHandler : MvcRouteHandler
{
    protected override IHttpHandler GetHttpHandler(RequestContext requestContext)
    {
        var versionNumberContext = requestContext.RouteData.Values["versionNumber"];
        requestContext.RouteData.DataTokens["versionNumber"] = versionNumberContext.ToString().Replace(".", "-");

        return base.GetHttpHandler(requestContext);
    }
}

基本上,我想用连字符替换小数点来解决这个问题。任何建议,将不胜AP preicated。

Basically, I am trying to replace the decimal point with a hyphen to work around the issue. Any suggestions would be greatly appreicated.

推荐答案

所以,事实证明,我还需要设置一个通配符应用程序映射,除了应用程序扩展通配符aspnet_isapi.dll的。这两个通配符必须在确认文件是否存在选项选中。

So it turns out that I also needed to set a Wildcard application map for "aspnet_isapi.dll" in addition to the application extension wildcard. Both wildcards must have the "verify that file exists" option unchecked.

这篇关于路由IIS6上有小数在路线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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