4
votes

I have an mvc application running on IIS 7.0 on windows vista.The appication is redirecting to the proper controller and action.But i am getting an error saying view is not found in the path, when the view is present at the particular path.

Route is as shown below.

routes.MapRoute( "Default", // Route name

"home/{action}/{id}", // URL with parameters

new { controller = "Home", action = "Index", id = "" } // Parameter constraints );

I am getting the error as The view 'Index' could not be located at these paths: ~/Views/Home/Index.aspx, ~/Views/Home/Index.ascx, ~/Views/Shared/Index.aspx, ~/Views/Shared/Index.ascx when i run the mvc application http://localhost/mvcsf/Home/

3

3 Answers

0
votes

Try something like this, it seems like it lies in the Windows features that comes with IIS 7 :

http://blogs.dovetailsoftware.com/blogs/kmiller/archive/2008/10/07/deploying-an-asp-net-mvc-web-application-to-iis7.aspx

1
votes

I had to reconfigure IIS to handle MVC apps. Check this one out as well:

MVC Config on IIS v6.0

0
votes

The choice of view is defined by the controller. What does the home controller do for the Index action? If this is the vanilla site generated by the system, then it is expecting to find "~/Views/Home/Index.aspx", via the controller's action (below). So: does this index page exist?

    public ActionResult Index()
    {
        ViewData["Title"] = "Home Page";
        ViewData["Message"] = "Welcome to ASP.NET MVC!";

        return View();
    }

(the default view has the pattern {controller}/{action}; you can specify other views via overloads on View(...))