简体   繁体   中英

Problem to run MVC 3.0 application with IIS7

I have created application using: Default Web Site >> Right Click >> Add Application

Added following details Alias: CAFM Physical Path: path of my application Application pool: ASP.Net v4.0

Now i type following in Internet Explorer, then it is working fine. http://localhost/cafm/Authentication/logon

Routing Code:

 public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("favicon.ico");
            routes.IgnoreRoute("Default.aspx");
            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Authentication", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }

Problem: If i type only following in internet explorer then it is giving me an error http://localhost/cafm/

Error:
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /cafm/

Please help me, how could i set default page to Authentication if user type only http://localhost/cafm .

Any suggestion would be appreciated! Thanks
Imdadhusen

May be your route should point to action LogOn not Index

routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Authentication", action = "LogOn", id = UrlParameter.Optional } // Parameter defaults
            );

Lg
warappa

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM