Nancy Razor Viewengine not found

I am using Nancy 0.14.1.0 with a view of Razor. Everything is going fine as long as I work with the internal web server in VS 2010. Now I deployed the material on my web server with IIS 6. Route

Get["/api/v1/admin/clients"] = parameters => { return View["Admin/view", new DataAccessLayer(Context).admin_get_clients()]; }; 

which returns a list of customers (it doesn't matter here).

Directory structure on the server

  bin
 Content
 Shared
    | --- _Layout.cshtml
 Views
    | --- Admin
          | --- view.cshtml

The exception that I catch is

  Nancy.ViewEngines.ViewNotFoundException: Unable to locate view 'Admin / view' Currently available view engine extensions: sshtml, html, htm Locations inspected: ,,,, views / api / Admin / view, api / Admin / view, views / Admin / view, Admin / view Root path: C: \ Inetpub \ Websites \ Test \ api \ 

As far as I am concerned, this is a record of “available extensions for viewing”: I am skipping cshtml here ... although I think my web.config contains the correct entry:

 <compilation debug="true" targetFramework="4.0"> <buildProviders> <add extension=".cshtml" type="Nancy.ViewEngines.Razor.BuildProviders.NancyCSharpRazorBuildProvider, Nancy.ViewEngines.Razor.BuildProviders" /> <add extension=".vbhtml" type="Nancy.ViewEngines.Razor.BuildProviders.NancyVisualBasicRazorBuildProvider, Nancy.ViewEngines.Razor.BuildProviders" /> </buildProviders> </compilation> 

Nancy module works fine: I added a route

  Get["/api/v1/admin/clients/{id}"] = parameters => { return "Hello"; }; 

and get "Hello" ...

Any clues?

+4
source share
4 answers

You did not deploy the Nancy razor package or cannot download it for any reason (possibly a dependency error), so it does not list file types.

+2
source

Close, but the Nancy razor bag did not disappear. Nancy's razor package was deployed. The only thing missing was System.Razor.dll. I also deployed and did :)

+1
source

I found that this problem is still happening with Nancy template projects. You need to remove and re-add Nancy Nancy links. Enabling package recovery does not seem sufficient.

0
source

In this problem, I came across a self-supporting Nancy from a console application that referenced a separate "Internet" DLL project. DLL razors were not copied to the output folder, even if the console project referenced the web project and the web project referenced the corresponding razor libraries.

Since dynamic razor libraries load dynamically, they are not copied to the output console folder. A further discussion of the main problem is here: Is the "Copy local" transitional for project references?

0
source

All Articles