I’m using Nancy 0.14.1.0 with a Razor view. Things are going fine as long as I work with the internal webserver in VS 2010. Now I did deploy the stuff to my webserver running IIS 6. The route is
Get["/api/v1/admin/clients"] = parameters => {
return View["Admin/view", new DataAccessLayer(Context).admin_get_clients()];
};
which returns a List of clients (doesn’t matter here).
The directory structure on the server is
bin
Content
Shared
|--- _Layout.cshtml
Views
|--- Admin
|--- view.cshtml
The exception 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\
What concerns me a bit is the “available view engine extensions” entry: I’m missing cshtml here… although I guess my web.config contains the right 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>
The Nancy Module behind works fine: I have added the route
Get["/api/v1/admin/clients/{id}"] = parameters => {
return "Hello";
};
and get the “Hello”…
Any hints?
You haven’t deployed the Nancy razor package, or it can’t load it for some reason (dependency missing maybe), that’s why it does’t list the file types.