ASP.NET MVC issue - asp.net-mvc

I have a ASP.NET MVC app and when I run it, it loads my Index action on my HomeController
by default ok.
But when I put in this URl I get 404 - Not Found error
http://localhost/MyGoogleApp/Home/Index
This is the same for any action I put in in Home Controller.
Something fundamentally wrong, any ideas?
Malcolm

You probably have a configuration problem with URL mapping in IIS itself.
I haven't worked much with IIS7, but I think this is what you should check:
Managed pipeline mode should be 'Integrated'.
web.config should include system.webServer with all standard stuff new MVC project puts there (I can't check what exactly right now).

Related

Unable to open a published MVC Project

I'm a total beginner so sorry in advance.
I used VS13 to build a MVC project and published it to my webspace. Now I'm unsure which file or path I need to specify in my forwarding config in order to open the website.
I tried
/Views/Shared
to get _Layout.cshtml and
/Views/Home
to get Index.cshtml but none of these are working. I also changed some admissions but it always shows me this
Forbidden - You don't have permission to access / on this server.
when I'm trying to open the website.
Any ideas on what I'm doing wrong?
With MVC You don't access views like traditional ASP.NET WebForms i.e. /path/to/view.aspx. Everything is handled via routing & controllers.
By default you will have a HomeController which will have an Index action which is invoked via a GET request. Assuming you haven't changed any of the default routing configuration you would just need to navigate to www.domainname.com/home to see your Index page.
The default routing configuration looks like /controller/action/parameters, MVC will always work this way unless you tell it different. If you don't pass a specific action (like I didn't with the home url) the Index action of the controller is assumed.

ASP.NET MVC2: Can't find controller

I have an MVC 2.0 web site that is using Areas. When I go to the default page (localhost/mywebsite/default.aspx), it correctly routes to the correct action in the correct controller and renders the default view correctly.
But on the page I have several Html.ActionLinks, and these do not seem to be able to find the Controller. When I click on the links in the page, I get a 404 error.
The URLs are what I expect: localhost/mywebsite/MyAreaName/Home/Index (for example). I've also tried localhost/mywebsite/Areas/MyAreaName/Home/Index, but this also gives me a 404.
How do I get the Controller to be recognized?
You probably don't have your IIS settings setup correctly to map the requests correctly.
Is IIS verify that you have set the "Wildcard application maps" to:
c:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
And make sure you have the "Verify file exists" checkbox unchecked.
Walkthrough - read section "IIS6 Extension-less URLs"
(source: haacked.com)
More information with IIS 6 MVC setup
More IIS Info
EDIT: Since your using IIS 7, verify that it is running in integrated mode. If it is running in classic mode the mapping is NOT done automatically just like the way IIS6 works.
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
You're using areas, have you registered the area routes?
ASP.NET MVC 2 Beta single-project Area registration getting HTTP 404
#Kelsey, I did have the app pool set correctly with integrated pipeline mode. But thanks for leading me down the correct path. I had the required config settings in a web.config in the Area, and not in the root of the web site, so the routing was never applied. I moved the config settings the the root level web.config and everything is working.
Thanks for your help, and Meff, thanks for all your ideas as well.

IIS6 Problems with ASP.NET MVC

I have a ASP.NET MVC page. I Configured a IIS Website and added the additonal H:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll.
my Directory Structure is like that
/
../App_data/
../bin/
../Content/
../Properties/
../Scripts/
../Views/
../Default.aspx
../Global.asax
../Web.config
My page is configured to port 9090.
If i try to access the page i get the "default" Page. But if i try to access any other page than the //myServer:9090 like //myServer:9090/home (which is the default method in my HomeController) i get a "page not found" error page.
For me it looks like he does'nt execute the assambly. In the Debbuging Server all runs nice.
What could be the Problem?
P.S: If i forgort something pls ask for! thanks!
Here's a nice post explaining how to configure ASP.NET MVC to run on IIS6 using extensionless routes.
Take a look at this page. You have to do different things to IIS to get MVC to run based upon what version of IIS you are using.
The Problem was that i use a 64BIT Server so i had to unclick "confirm that file exists"

ASP.NET MVC app not browsing to pages only Index.aspx on root

I have an MVC 1.0 app just setup but it only shows the Index.aspx page
of Home.
Seems like the routing engine is not being engaged.
I get a 404 error when i try to browse other pages.
Any ideas why this might be?
Malcolm
It's probably that the ASP.NET DLL isn't being called for your request. If you are talking about IIS, Phil Haack has a great article on how to sort it out. Note: Scroll down for .* version :)
Essentially, you are telling IIS that for every extension, it should look use the .NET DLL to run it, but don't check to see if the file exists first (because in MVC, the files don't exist).

Trying to make Weborb .NET work with ASP.NET MVC

We have been using weborb for .net on an existing application for some time now and it has worked very well. We decided to rewrite our application in ASP.NET MVC and now I need to make weborb work with mvc. I have been getting a 404 the resource cannot be found error while trying to connect to the weborb.aspx page. I have added all of the appropriate entries to the web.config file and I even found this article explaining how to make the two work together
http://aspzone.com/tech/how-to-get-weborb-and-asp-net-mvc-to-work-together/
But to no avail. I can't make it work. Thanks.
If 404 is given then there is no such resource. Most likely the MVC tries to route the request and cannot find appropriate one.
Try to add ignore route in the beginning of routes registration. Something like this:
routes.IgnoreRoute("weborb.aspx/{*pathInfo}");
My problem was that I had the project set up incorrectly as a website and not an mvc application. Once I did that the route explained the blog post I referenced worked like a charm.

Resources