Nancy.ViewEngines.ViewNotFoundException: Cannot find view 'index.cshtml'

Experienced issue documented here https://github.com/NancyFx/Nancy/issues/1528

In particular, while I am including the Razor View Engine according to what I understand is the correct configuration, it does not always work. Self-hosted.

Oddly enough, I am not experiencing any problems on my Mac (Mono / Xamarin specific build) or 2 test computers (windows / windows build) - they work fine, but 2 other test machines (windows / windows build) are indeed experiencing the problem.

It is difficult to determine why this would be the case.

Using .NET 4.5

Definitely there is a RAZOR DLL engine present and even forcibly tied to the bootloader (and no exceptions are thrown)

Any hints? Thank!

EDIT 1: Here is the complete stack trace as requested. I subsequently changed it to explicitly "index.cshtml", but the error reported is basically the same (you just see the .cshtml after the index in the post). Note the lack of cshtml as a supported extension extension

Nancy.RequestExecutionException: Oh noes! ---> Nancy.ViewEngines.ViewNotFoundException:     Unable to locate view 'index'
Currently available view engine extensions: sshtml,html,htm
Locations inspected: views/Home/index-en-US,views/Home/index,Home/index-en-US,Home/index,views/index-en-US,views/index,index-en-US,index
Root path: XXX
If you were expecting raw data back, make sure you set the 'Accept'-header of the request to correct format, for example 'application/json'
   at Nancy.ViewEngines.DefaultViewFactory.GetRenderedView(String viewName, Object model, ViewLocationContext viewLocationContext)
   at Nancy.ViewEngines.DefaultViewFactory.RenderView(String viewName, Object model, ViewLocationContext viewLocationContext)
   at Nancy.Responses.Negotiation.ViewProcessor.Process(MediaRange requestedMediaRange, Object model, NancyContext context)
   at Nancy.Responses.Negotiation.DefaultResponseNegotiator.NegotiateResponse(IEnumerable`1 compatibleHeaders, NegotiationContext negotiationContext, NancyContext context)
   at Nancy.Responses.Negotiation.DefaultResponseNegotiator.CreateResponse(IList`1 compatibleHeaders, NegotiationContext negotiationContext, NancyContext context)
   at Nancy.Responses.Negotiation.DefaultResponseNegotiator.NegotiateResponse(Object routeResult, NancyContext context)
   at Nancy.Routing.DefaultRouteInvoker.<>c__DisplayClass9.b__5(Task`1 completedTask)
   --- End of inner exception stack trace ---
   at Nancy.NancyEngine.InvokeOnErrorHook(NancyContext context, ErrorPipeline pipeline, Exception ex)

      

+3


source to share


1 answer


Make sure you have a valid razor config https://github.com/NancyFx/Nancy/wiki/Razor-View-Engine



0


source







All Articles