2013-12-18 58 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