2013-12-18 133 views
6

我正在查看github上的Razor Rockstars示例项目,尝试了解ServiceStack V4和Razor如何粘合在一起。将剃须刀RockStars移植到ServiceStack V4

我特别用在SS剃刀演示下面的一段代码挣扎:

SetConfig(new EndpointHostConfig { 
      CustomHttpHandlers = { 
       { HttpStatusCode.NotFound, new RazorHandler("/notfound") }, 
       { HttpStatusCode.Unauthorized, new RazorHandler("/login") }, 
      } 
     }); 

我知道从现在EndpointHostConfig简直是hostconfig里的文档,但我似乎无法找到CustomHttpHandlers在Service Stack V4 release notes。有什么明显的我失踪了吗?

在此先感谢。

回答

5

的hostconfig中仅限于配置,在V4大多数曾经是在配置处理程序已移动到APPHOST,e.g:

this.CustomErrorHttpHandlers[HttpStatusCode.NotFound] = new RazorHandler("/notfound"); 
this.CustomErrorHttpHandlers[HttpStatusCode.Unauthorized] = new RazorHandler("/login"); 
+0

啊,感谢一如既往mythz! :) – nover

+0

也谢谢!您可以将此添加到v4发行说明中吗? – kinstephen

+1

@kinstephen np完成,thx。 – mythz