3

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はすでにオンになっています。

これを機能させる方法についてのアイデアは大歓迎です!

4

1 に答える 1

2

残念ながら、最も重要な部分、つまりRazorビューの名前と場所を省略しました。

Snaphotページは、ServiceStackが探しているビューを見つけられない場合のフォールバックです。この場合、[DefaultView( "AboutUs")]を指定しているため、ServiceStackは「AboutUs.cshtml」という名前のビューを探します。 / Views /ディレクトリ、それはあなたが持っているものですか?

于 2012-11-17T04:06:27.940 に答える