0

I am trying to use View Engine to return an HTML page in my window application. URL gets called but when i try to return a View, i get ViewNotFoundException error.

In an error message, I cant see the extensions available and locations inspected but i still get an error as Below:

Nancy.RequestExecutionException: Oh noes! ---> Nancy.ViewEngines.ViewNotFoundException: Unable to locate view 'test' Currently available view engine extensions: sshtml,html,htm,cshtml,vbhtml

I have checked the Demo project on git and it works fine but that's a web project whereas mine is window service (i might be missing something). Has anyone tried to implement View Engine in windows service and got it working.

Error is quite self-explanatory but i cant seems to get my head around where the test file should go for it to work.

Edit:
Nancy version: 1.4.2

I tried var foo = typeof(RazorViewEngine); and it does return all the View Engine values with locations inspected and all that.

My Project structure is:

Modules ---- myModule.cs Views ---- Test.cshtml

views/test is in locations inspected but it looks like, its looking somewhere instead of my structure.

Thanks in advance

Jay
  • 1,037
  • 5
  • 23
  • 41
  • Please more details: `Project structure, Nancy version etc`. Also have you seen: https://github.com/NancyFx/Nancy/wiki/View-location-conventions – zulqarnain Feb 21 '17 at 16:18
  • @zulq I have looked into location-convention link (thanks) and added couple of entries. Now in an error, it looking at only those location which i have mentioned in ConfigureConventions but i still get the same error. – Jay Feb 21 '17 at 17:03
  • Have you installed the Razor view engine nuget package? – zulqarnain Feb 22 '17 at 08:38
  • Yes, The problem was "copy to output dir" was not set to "copy always" for template files. All fixed – Jay Feb 22 '17 at 10:00

0 Answers0