ServiceStack Razor not finding right view

28 views Asked by At

I have a ServiceStack site that uses ServiceStack.Razor without issue. I upgraded from 4.0.50 to 5.1.0 - with no other substantive changes - and now the Razor view engine is not rendering for service methods with a DefaultView. If I instead return an HttpResult and set the view that way, it does work. Did the behavior change from 4.x to 5.1, or am I missing something?

Original (works):

    [DefaultView("UploadRetailerReports")]
    public object Get(AdminHome request)
    {
        return new HttpResult()
        {
        };
    }

After (required workaround):

    public object Get(AdminHome request)
    {
        return new HttpResult()
        {
            View = "UploadRetailerReports"
        };
    }
1

There are 1 answers

2
mythz On

I've tested a [DefaultView] attribute as a class and action attribute in this commit and they're both working as expected and rendering the selected View.