[Mono-aspnet-list] MVC 3 App Cannot Find Template

Daniel J. Summers daniel.summers.2415 at gmail.com
Tue Mar 29 20:38:24 EDT 2011


On Mon, Mar 14, 2011 at 5:33 AM, Daniel J. Summers <
daniel.summers.2415 at gmail.com> wrote:

> But, when it tries to render the home page, the following error occurs:
>
> System.InvalidOperationException: The view 'Index' or its master was not found or no view engine supports the searched locations. The following locations were searched:
> ~/Views/Home/Index.aspx
> ~/Views/Home/Index.ascx
> ~/Views/Shared/Index.aspx
> ~/Views/Shared/Index.ascx
> ~/Views/Home/Index.cshtml
> ~/Views/Home/Index.vbhtml
> ~/Views/Shared/Index.cshtml
> ~/Views/Shared/Index.vbhtml
>   at System.Web.Mvc.ViewResult.FindView [snip]
>
> I got an app to deploy and work with this.  A big thanks to Carl Hoerberg,
who exchanged e-mails with me offline while we determined the solution, and
Scott Hanselman, who wrote a blog post at
http://www.hanselman.com/blog/BINDeployingASPNETMVC3WithRazorToAWindowsServerWithoutMVCInstalled.aspx
about
"bin deploying" MVC 3.  Here's how I got it to work:

 - I added Microsoft.Web.Infrastructure.dll, System.Web.Razor.dll, and
System.Web.WebPages.Razor.dll as local references to my application, and set
"CopyLocal = true" on each of them within the VS project.
 - I added "CopyLocal = true" on System.Web.Helpers, System.Web.Mvc, and
System.Web.WebPages within the VS project.

It appeared to be the missing Razor DLLs that were causing the "unable to
find view" problem; interestingly, this is working without precompiling the
views.  I'll probably switch the views to being precompiled anyway, just to
save that overhead every time the app is started; when this happens, I'm
guessing that I'll probably need to put Carl's engine-tweaking code in the
app.

There is one oddity that remains; the first time I hit the app, I get an
error that the system "does not have access to the key requested".  In
searching for that, I saw something that said that the web server needed
write access to $HOME/.mono.  As the web server runs as www-data, I created
a .mono directory in its home, and chown'd it to www-data:www-data.
 However, when I redeploy the app or bounce Apache, the first hit to the
site still gives me the error.  It's coming out of code in
Microsoft.Web.Infrastructure - it's not a huge deal, but if anyone has an
idea about that, I'm all ears.

Thanks again to Carl for helping me with all this.  I'm so excited to have
MVC 3 running on my Linux box!  I'm wishing that all the programming
languages I have to use on a daily basis had Razor - it's that quick.  :)

-- 
*Daniel J. Summers*
*Owner, DJS Consulting*
E-mail <daniel.summers.2415 at gmail.com> • Website <http://djs-consulting.com>
 • Support <http://support.djs-consulting.com> • Tech
Blog<http://techblog.djs-consulting.com>

GEEKCODE 3.12 GCS/IT d s-:+ a C++ P--- L++ E--- W++ N++ o? K- w !O M--
V PS+ PE++ Y? PGP- t+ 5? X+ R* tv b+ DI++ D+ G- e<++ h---- r+++ y++++
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-aspnet-list/attachments/20110330/8817da07/attachment-0001.html 


More information about the Mono-aspnet-list mailing list