I tried to precompile my ASP.NET MVC application and deploy it to an IIS6 box (with wildcard mapping), however I am getting an error with rendering partial views (user controls). Its working fine on my dev machine before precompiling.
The error is:
Server Error in ‘/’ Application.
The partial view ‘ListGrid’ could not
be found. The following locations were
searched:
~/Views/Initiative/ListGrid.aspx
~/Views/Initiative/ListGrid.ascx
~/Views/Shared/ListGrid.aspx
~/Views/Shared/ListGrid.ascx
I checked Views\Shared for the file and it was not there, which I thought was normal because its precompiled. But just for giggles I put a blank file in that folder names ListGrid.ascx, but then I got this error:
Server Error in ‘/’ Application.
The file ‘/Views/Shared/ListGrid.ascx’
has not been pre-compiled, and cannot
be requested.
I googled and searched SO but could not find any similar problems, but had no luck.
Although you can precompile an MVC site the ascx and aspx view files are not in the compiled dll only the .cs files are. You will still need to deploy the .aspx and .ascx view files.
Hope this helps