2012-02-17 3 views
0

방금 ​​MVC3 프로젝트를 새로 만들었고 servicestack mvc를 nuget을 통해 설치했습니다.MVC3에서 서비스 스킬 사용 중 작동하지 않음

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.IgnoreRoute("api/{*pathInfo}"); 
routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" }); //Prevent exceptions for favicon 

Servicestack이 오류를 제공합니다 : 그럼 내가있는 Readme.txt에 따라, Global.asax.cs에서 RegisterRoutes이 추가 :

 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을 사용하고 있습니다. 위해 Application_Start에서

1.Disable MVC WebApi 등록 :

+0

당신은 ServiceStack.Host.Mvc를 설치 했나요 ? 그리고 Web.config는/api 경로에 ServiceStack을 확실히 탑재하고 있습니까? (이것은 NuGet 설치로 수행해야합니다). 무슨 URL이 404를주는거야? – mythz

+0

@mythz 사과, 나는 당신이 의견을 게시했다는 것을 깨닫지 못했습니다. 예, Web.config가 올바른 것 같습니다. localhost : 28945/api는 이전에 언급 한 행이 주석 처리되지 않았을 때 404를 제공합니다. 이 문제를 설명하기 위해 예제 프로젝트를 업로드했습니다 : dl.dropbox.com/u/49815808/StackOverflow/Test2.zip – Michael

+1

@Michael - 완전히 확신 할 수는 없지만 위의 IgnoreRoute를 살펴보면, 앞에 슬래시가 필요할 수 있습니다. 경로는 무시됩니다. 대신 http : // localhost : 28945/api /를 시도하십시오. –

답변

0

이 두 단계를 수행하려고합니다. 'API /'와 같은

//WebApiConfig.Register(GlobalConfiguration.Configuration); 

2.Ignore MVC 경로가

routes.IgnoreRoute("api/{*pathInfo}"); 
+0

그리고 [MVC Integration wiki!] (https://github.com/ServiceStack/ServiceStack/wiki/Mvc-integration)를 따르십시오. :) – mythz

관련 문제