路由IIS6上有小数在路线上有、小数、路由、路线

2023-09-04 01:08:35 作者:ㄣ甜甜圈o

我有一个路径在我的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.