Mvc Project 404 Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About asp.net mvc 404 error Us Learn more about Stack Overflow the company Business Learn more about hiring
Asp.net Mvc 404 Page
developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the mvc diagnostics Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MVC 4 application giving a 404 404 error mvc routing when deployed up vote 6 down vote favorite I have an ASP.NET MVC 4 project using .NET 4.5 that I am trying to publish to IIS 7.0 using Visual Studio 2012. When I debug the application in IIS Express everything works wonderfully. When I publish it to the server, the MVC requests return 404. I have a few aspx pages on the site and they all
Mvc Return 404
work fine. Below is my routing scheme. It is boilerplate code: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); Thanks. Edits: I got it! I had to add the following to system.webServer in my web.config:
ASP.NET Community Standup Forums Help Home/ASP.NET Forums/General ASP.NET/MVC/MVC application not working on localhost - mvc 404 not found 404 error MVC application not working on localhost - 404 routedebugger mvc 5 error RSS 8 replies Last post Mar 24, 2011 06:26 PM by tugberk_ugurlu_ ‹ Previous
Mvc 5 404
Thread|Next Thread › Print Share Twitter Facebook Email Shortcuts Active Threads Unanswered Threads Unresolved Threads Support Options Advanced Search Related Links GuidanceSamplesVideos Reply sandeepbhuta... http://stackoverflow.com/questions/16178821/mvc-4-application-giving-a-404-when-deployed Participant 873 Points 373 Posts MVC application not working on localhost - 404 error Jan 16, 2009 12:13 AM|sandeepbhutani304|LINK Hi, I build an MVC application and able to run it from VS Development Server (Press F5) (http://localhost:27051/). But application is not working on localhost. (http://localhost/MVC1/) (http://localhost/MVC1/is working but http://localhost/MVC1/Product/ is https://forums.asp.net/t/1371893.aspx?MVC+application+not+working+on+localhost+404+error not working. I am getting 404 not found error. I have following routes defined in Global.asax.cs routes.MapRoute("Products", "Product/{action}/{ProductNumber}", new { controller = "Product", action = "Index", ProductNumber = "" }); routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } );
I think the problem is due to the application name after localhost (/MVC1/) Please suggest the workaround. I have no access to IIS, so I can't change IIS settings/mappings. Also as I may have to migrate it to different server so I do not know the application name in advance (I might have to move it to http://www.somesite.com/testmvc/). MVC in subdirectory Mark as answer if you are agree with the solution. This helps the community. Sandeep Bhutani Reply jeloff Participant 1640 Points 432 Posts Re: MVC application not working on localhost - 404 error Jan 16, 2009 01:10 AMthe default HandleError Attribute in MVC. In this article, we will see how we can use the HandleError attribute to quickly put together an exception http://www.devcurry.com/2012/06/aspnet-mvc-handling-exceptions-and-404.html handling mechanism that helps hide the ‘dark' underbelly of your application but helps you debug with the same configuration. We will also look at a solution to handle 404 errors gracefully. Overall we try to achieve the following on IIS 7+ Goal 1 - Use MVCs HandleError action filter to take care of Unhandled/Unexpected errors Goal 2- See only user friendly messages at 404 error Runtime Goal 3 - See exception stack traces at debug time Goal 4- Manage 404 error with a proper error message Goal 5 - Keep a 404 Response status The HandleError Attribute The HandleError attribute helps mark controller classes for ‘Unhandled Error' exceptions. The HandleErrorAttribute() attribute filter will pipe the Unhandled exceptions to this attribute filter enabling you to take appropriate exception. The attribute asp.net mvc 404 filter is put in place by the default MVC template in the Global.asax (or for MVC4 in the App_Start\FilterConfig.cs) by adding the Action filter as follows: public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); } By default, if you turn on CustomErrors, the behavior of the HandleErrorAttribute is to redirect you to the default Error page. Setting up the Custom Errors page Setup of the Custom Errors page is easy. We simply turn on the CustomErrors in the web.config. To Test the setting we throw an exception in the ‘About' action method of the Home Controller public ActionResult About() { ViewBag.Message = "Your app description page."; throw new ApplicationException("Testing default ErrorHandler attribute"); //return View(); } Now when we run the application and click on ‘About' we see the following This is the default output from Errors.cshtml in the Shared folder of a default MVC project. As we can see, it returns a correct 500 status message. At this stage, we have achieved the first and second goals we set out to achieve. However we have lost the stack trace. Let us fix that without lo