路由到空白请求使用IIS 6.0 MVC asp.net [英] routing to blank request in mvc asp.net using IIS 6.0

查看:208
本文介绍了路由到空白请求使用IIS 6.0 MVC asp.net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图连接到我的网站发表使用下面的URL。
http://www.mywebsite.com/
我不断收到:
传入的​​请求不符合任何路线。
这里是我的路由规则:

I'm attempting to connect to my published website using the following url. http://www.mywebsite.com/ I keep getting: The incoming request does not match any route. Here are my routing rules:

routes.MapRoute(
                "Default",                                              // Route name
                "{controller}.aspx/{action}/{id}",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );

            routes.MapRoute(
                "Default2",                                              // Route name
                "/",                           // URL with parameters
                new { controller = "Home", action = "Index", id = "" }  // Parameter defaults
            );

我使用的身份验证这样:

I'm using authentication as such:

<authentication mode="Forms" >
    		<forms loginUrl="~/Home.aspx/Index"
    				protection="All"
    				timeout="300"/>
    	</authentication>

当我没有验证它关系到正确的页面,但是当我验证它抛出上述错误。我使用的是IIS 6.0和做整个URL重写解决办法的选择。

When I'm not authenticated it goes to the correct page, but when I am authenticated it throws the above error. I'm using IIS 6.0 and doing the whole rewriting url workaround option.

我是什么失踪?

推荐答案

修改/中的默认设置2路线

Change "/" in "Default2" route to "":

routes.MapRoute("Default2", "", new { ... });

另外,还要确保你已经按照本指南:的 http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx 的Default.aspx 文件,如果你是在IIS6。

Also make sure you have followed this guide: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx for Default.aspx file if you are on IIS6.

这篇关于路由到空白请求使用IIS 6.0 MVC asp.net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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