I have a very simple module and view setup in NancyFx, such as this;
public class LoginModule : NancyModule
{
public LoginModule()
{
Get["/login"] = _ => View["login", null];
}
}
The view for this page is located in project\views\login\login.cshtml.
I've configured a custom view convention to try and solve the problem, e.g.
nancyConventions.ViewLocationConventions.Clear();
nancyConventions.ViewLocationConventions.Add((viewName, model, viewLocationContext) => string.Concat("views/", viewName));
nancyConventions.ViewLocationConventions.Add((viewName, model, viewLocationContext) => string.Concat("views/", viewLocationContext.ModuleName, "/", viewName));
I'm using Owin (Nancy and Microsoft packages with the ASP.NET hosting package) to manage my web api layer.
The application works just fine when tested locally, but fails when deployed to Azure.
Nancy.RequestExecutionException: Oh noes! ---> Nancy.ViewEngines.ViewNotFoundException: Unable to locate view 'login' Currently available view engine extensions: sshtml,html,htm,cshtml,vbhtml Locations inspected: views/login,views/Login/login
Note it's logged the exact folder structure of my views, but for some reason, couldn't find the view file. It's noted the supported view files, so has picked up the Razor package.
It all works if I move the view files into the \views folder, but I'd like to logically separate the files if I can.
The projects are split with the Project.Web project referencing Project.WebApi (the Owin project where the Nancy bootstrapper is defined).
In response to another post here I added the Owin hander to the Project.Web web.config file.
<handlers>
<add name="Owin" verb="*" path="*" type="Microsoft.Owin.Host.SystemWeb.OwinHttpHandler, Microsoft.Owin.Host.SystemWeb" />
<add name="Nancy" verb="*" type="Nancy.Hosting.Aspnet.NancyHttpRequestHandler" path="*" />
</handlers>
But no success.
D:\home\site\wwwroot
. – Aaron