Appears that in view selection, if CacheResponse attribute is applied, #1 will not work. You must set DefaultView attribute or use the convention of request/response dto.cshtml – is this correct / by design or am I doing something wrong?
[CacheResponse(Duration = 60)]
public object Get(Rockstars5 request)
{
return new HttpResult(new RockstarsResponse6())
{
View = "DevSpecified1" //#1 this does not work if CacheResponse attribute is set. returns the html report view
}
}
Are you asking whether it’s still possible to resolve the view from the Request DTO name? That’s still possible, if you don’t have anything with higher precedence, a Get(Rockstars5 request) should use a view named Rockstars5.cshtml in your /Views folder.
Thanks Demis – Unfortunately I cannot get 4.5.13 to work.
Could not load file or assembly 'System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
The only thing I did was update the Nuget packages. I noticed that in the project file definition, there is a reference removed:
ok strange, for some reason ServiceStack.Razor didn’t end up on MyGet even though CI says it deployed it like everything else. I’ve redeployed to MyGet where ServiceStack.Razor made it this time, can you try upgrading again?
Yeah, 4.5.8 is working. I guess I’ll keep using it.
I update to 4.5.12 - when I start the app, the browser physically downloads the login.cshtml file.
I update to 4.5.13 - YSOD saying can’t find System.Web.Razor
Only difference when I do the upgrade is that in the csproj it’s removing the reference for System.Web.Razor:
Edit: Oddly when I start a new SS Razor Web App in VS, and upgrade to 4.5.13, it’s works. I guess I’ll go thru all of project files/configs and compare them.
Yeah, when upgrading, System.Web.Razor is being removed as a reference. I had to physically go back and add reference manually to it in \packages\Microsoft.AspNet.Razor.3.2.3\lib\net45
It’s working now. Any ideas why it would be removed when upgrading?
It removes the old config when uninstalling before adding a new one back when it’s installing, I think the cause of this issue was a bad upgrade when ServiceStack.Razor wasn’t published on MyGet. Can you try uninstalling ServiceStack.Razor and any Microsoft Razor packages and removing all Razor config from web.config, then manually add ServiceStack.Razor back?