asp.net mvc application application root issue
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?
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: ASP.NET MVC in a virtual directory
http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
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.
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.
精彩评论