Razor.ServiceStack – 视图不呈现,只是默认的“快照”

我已经使用http://razor.servicestack.net/设置了一个网站。

我用下面的例子创build了几个视图和匹配的服务

服务示例:

using ServiceStack.ServiceHost; using ServiceStack.ServiceInterface; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace website { [DefaultView("AboutUs")] public class AboutUsService : Service { public object Get(AboutUsRequest request) { return new AboutUsResponse { //any properties that need to be set on the response object can be done inline here }; } } [Route("/About-Us")] public class AboutUsRequest { //any request parameters we need can be provided here. They should be auto parsed from the request } public class AboutUsResponse { //any response properties we want to use in the view can be defined here } } 

查看示例(位于/Views/AboutUs.cshtml)

  @inherits ServiceStack.Razor.ViewPage<website.AboutUsResponse> <html><body><h1>About Us</h1></body></html> 

这在窗口加载罚款,但无法加载在Mono / NginxFastCGI,而是只显示默认的API快照页面:

 Snapshot of AboutUsRequest generated by ServiceStack on 11/17/2012 02:30:14 view json datasource from original url: http://dev.mydomain.com:80/About-Us? in other formats: json xml csv jsv 

是否有一些具体的变化,我需要configuration这个工作在Mono / Linux端? 顺便说一句,我有IOMAP =所有已经打开。

任何想法如何得到这个工作将不胜感激!

不幸的是,你遗漏了最重要的部分:剃刀视图的名称和位置。

Snaphot页面是ServiceStack无法找到它正在查找的视图的后备,在这种情况下,因为您已经指定了[DefaultView(“AboutUs”)],ServiceStack将在该视图中查找名为“AboutUs.cshtml”的视图/ Views /目录,你有什么?