views:

218

answers:

3

I have an ASP MVC application that I have deployed on a hosting service (discountasp.net) to an application folder that is a sub folder of the root application. ie:

-/[root]
-+/apps

both root and apps are setup as application folders in IIS.

When I hit the default page I get the error "The view '' or its master could not be found. The following locations were searched".

This application works when I deploy it on my test servers and I have verified that everything is correctly deployed, views are there, correct assemblies seem to be there. I believe that the MVC application is not using the correct application root and thus is unable to find the view pages.

I've read a number of related posts on this error, but none of the typical solutions are my problem: missing view files, missing master file. This works on a test machine that I have setup as closely to the hosting company as I can. Even when I have nested application folders.

Any thoughts on how to correct this?

A: 

Is "apps" part of the web folder hierarchy, or just a physical directory?

In case of the former: the view engine is going to check the /views folder for views, not /apps/views. You can modify (inherit and override) the default web form view engine and tell it where to find views, as indicated in this thread.

I think its funny how everyone keeps talking about how much more power MVC gives you over the request-response cycle, but I keep seeing these questions about very important parts of the process that are completely obscured and non-configurable. I'm not impressed with MVC.

David Lively
apps is a physical directory that is setup as an application directory
MikeD
and ya, I'm just evaluating MVC with a simple little app, not sure if I buy in yet...
MikeD
What is not configurable here? You _can_ change view locations as you need, can't you? Notice that VirtualPathProvider is not MVC, it is ASP.NET option - that's MS decision to keep compatibility with old ASP.NET (that you seem to like). Also, I don't think it's THAT hard; this question seems to have an easier answer: http://stackoverflow.com/questions/236972/using-virtualpathprovider-to-load-aspnet-mvc-views-from-dlls
queen3
What's not configurable? I shouldn't have to name my classes "HomeController", "FrakController", whatever, instead of whatever name makes sense in the context of my app. The routing mechanism should take a type reference not a string. I shouldn't have to create a new class to tell MVC where to find views; it should be in a config file. (Yes, I know I could do that myself, but that's more work to get around asinine assumptions in the framework). And, oh, yeah - not being able to put presentation-specific code in a view code-behind? WTF? So that the framework "enforces" the design pattern? Lame.
David Lively
+1  A: 

Do you know which version of IIS is running?

Your best results will come with IIS 7 in Integrated Pipeline Mode.

You can run in 6, but you have to do some work to get it going.

Here are a couple of helpful links: http://stackoverflow.com/questions/182993/asp-net-mvc-in-a-virtual-directory

http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx

jeffa00
It is IIS7 running in Integrated Pipeline Mode
MikeD
Thanks, these links indirectly led me to other SO questions that eventually answered the question.
MikeD
+1  A: 

So to close the loop on this. What the problem ended up being was the two separate web.config files where the root web.config was setting values that I was not removing in the sub application. I removed these and everything worked fine.

MikeD