0

I just created a new MVC3 project and installed servicestack mvc via nuget. I then added this to RegisterRoutes in Global.asax.cs, as per the README.txt:

routes.IgnoreRoute("api/{*pathInfo}"); 
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" }); //Prevent exceptions for favicon

Servicestack gives this 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. 

unless I comment out this in Global.asax.cs:

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

How can I get MVC3 and Servicestack to work. I'm using VS2010, IIS7.

4

1 回答 1

0

尝试执行以下两个步骤:

1.在Application_Start中禁用MVC WebApi注册。

//WebApiConfig.Register(GlobalConfiguration.Configuration);

2.忽略像'api/'这样的MVC路由

routes.IgnoreRoute("api/{*pathInfo}");
于 2013-11-06T13:09:19.810 回答