ServiceStack Razor ContentPage is in debug mode but not deployed

I am trying to create very simple content in ~ / View.cshtml consisting of

@inherits ViewPage ο»Ώ @{ Layout = "SimpleLayout"; ViewBag.Title = "Title"; } <div id="content-page"> <p>Test</p> </div> 

at ~ / Views / Shared / SimpleLayout.cshtml

 <!DOCTYPE HTML> <html> <head> <title>Simple Layout</title> </head> <body> <div id="content"> @RenderBody() </div> </body> </html> 

In debug mode it works fine, but when deployed, it shows

Compilation error

Description: An error occurred while compiling the resource required to service this request. Review the following specific error details and modify the source code accordingly.

Compiler Error Message: CS0146: Dependence of a circular base class using "RazorOutput.ViewPage" and "RazorOutput.ViewPage"

I try to follow the RockStars example as close as possible, so I don’t know what happened. My services work great.

Any suggestions would be appreciated.

Update

If the page name is changed (for example, NewPage.cshtml), then it will also not work in Debug, causing the same exception.

+4
source share
3 answers

In Web.Config make sure you have:

 <compilation debug="false"> 

I was getting the same error and this fixed it.

+2
source

Setting compilation debug="false" as suggested above does not work for me.

I had an error running locally in IIS Express and found that if I added it to web.config this would work:

 <appSettings> <add key="webPages:Enabled" value="false" /> </appSettings> 

I found this setting in the ServiceStack RazorRockstar example, comparing it line by line with my own project to find out why my work is not working.

+2
source

I was getting similar compilation errors when trying to make Razor pages. Make sure your AppHost website inherits from AppHostBase and not AppHostHttpListenerBase .

+1
source

Source: https://habr.com/ru/post/1469012/


All Articles