Paolo ponzano - 11 - Feb 4, 2015

Hello Demis,
I’ve some iussue serving MVC pages via ServiceStack.Razor.
I’ve added this small sample … calling the url http://localhost:1337/test  it should serve the view Test.cshtml but it continues to serve the default one … what am I doing wrong?


It appears your zip file was corrupted as I couldn’t extract it locally or using Zip Extractor online. 

By looking at the structure I can see that you’ve added /Views/Test.cshtml in your views directly but you’re trying to access it like a Content Page. You should read the difference between View Pages (razor pages in /Views - executed using the Service Response DTO as the ViewModel) and Content Pages (Razor Pages outside of /Views directory - Executed directly without a Service):

My guess would be to move the /Views/Test.cshtml in the root folder at /test.cshtml

Also just a reminder that there’s no need to address questions directly to me as it makes it less inviting for others who would be willing and able to help you as well.

paolo ponzano:

Hello Demis, here’s another file upload… please excuse me if I’ve address the email to you, and also I ask my excuses to the whole forum


+paolo ponzano have you moved /Views/Test.cshtml to /Test.cshtml as mentioned? Also please read the recommended link explaining the difference between /View pages and Content Pages:

paolo ponzano:

Hello,yes I’ve tried but with no luck… I think I’m missing something really stupid…

If you add a ResponseStatus to your TestResponse you will be able to see what the Error is.

It looks like you’ve copied the razor configuration from Razor Rockstars as it can’t find the RazorRockstar namespace in the Web.config, this should be replaced with your namespace, unfortunately your project seems broken as your Program and AppHost classes aren’t in any namespace and your project namespace is called OrmLiteMySql which is different to the name of the project “RazorTest”.