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?

share|improve this question
The App works if I deploy it to the root. It also works if it is deployed in apps with nothing deployed in root. As soon as I put anything as simple as a default.aspx file in root it stops working. – MikeD Nov 11 '09 at 23:41
Actually looks like when I drop the web.config into the root for the root application then it stops working. – MikeD Nov 12 '09 at 0:05

3 Answers

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.

share|improve this answer
apps is a physical directory that is setup as an application directory – MikeD Nov 11 '09 at 16:21
and ya, I'm just evaluating MVC with a simple little app, not sure if I buy in yet... – MikeD Nov 11 '09 at 16:23
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: stackoverflow.com/questions/236972/… – queen3 Nov 11 '09 at 18:33
1  
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 Nov 11 '09 at 18:43

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

share|improve this answer
It is IIS7 running in Integrated Pipeline Mode – MikeD Nov 11 '09 at 23:39
Thanks, these links indirectly led me to other SO questions that eventually answered the question. – MikeD Nov 19 '09 at 4:37

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.

share|improve this answer

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.