我已经使用http://razor.servicestack.net/设置了一个站点。
我创建了几个视图和匹配服务,示例如下:
服务示例:
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>
这可以在 Windows 上正常加载,但无法在 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
我需要配置一些特定的更改才能在 Mono/Linux 端工作吗?顺便说一句,我已经打开了 IOMAP=all。
任何有关如何使这项工作的想法将不胜感激!