0

新しい MVC3 プロジェクトを作成し、nuget を介して servicestack mvc をインストールしました。次に、README.txt に従って、これを Global.asax.cs の RegisterRoutes に追加しました。

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

Servicestack で次のエラーが発生します。

    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. 

Global.asax.cs でこれをコメントアウトしない限り:

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

MVC3 と Servicestack を機能させるにはどうすればよいですか。私はVS2010、IIS7を使用しています。

4

1 に答える 1

0

次の 2 つの手順を実行してみてください。

1.Application_Start で MVC WebApi 登録を無効にします。

//WebApiConfig.Register(GlobalConfiguration.Configuration);

2.「api/」などの MVC ルートを無視する

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