changing default document in iis 7 to MVC web application - asp.net-mvc

I am trying to change the default document of my localhost in iis 7. Currently it shows the default iis 7 page, I want it to show the homepage of application deployed under default website "Application". The application is an MVC 5 web application.
I have tried adding Application into default document option and tried in web config file of the server but its still showing iis 7 page.

MCV or Razor Web pages do not follow the default document scheme. For example if you are setting index.php to be the default document but then you have default.cshtml beneath it, default.cshtml will still load first. The only alternative is either to use URL rewriting to redirect your application or actually changing the routing code in your app to set default routes.

Related

how to set default document in web.config file in ASP.NET MVC application..?

I'm working on ASP.NET MVC application it is working fine now i want to host it on IIS server, I'm doing this as generic procedure when I'm opening it on browser that time it showing all directories list what now how can set my default action in web.config file.
You don't set a default document with MVC. There's no such thing as documents in MVC, let alone a default one. If you're getting a directory listing instead of your app being loaded, then there's some problem with your setup. Most likely, you don't have it as an actual application in IIS, but just a virtual directory

MVC3 deployment to IIS6 causes page not found but wildcard application maps have been set

I am deploying an MVC3 app to IIS6. If I navigate to the starting point of the application myserver/myapp it redirects to myserver/myapp/Account/LogOn?ReturnUrl= but it then show a 404 page not found error.
The views are in the correct folders. Security permissions are correct. If I deploy locally it works on my local iis7.5 perfectly. wildcard application maps have been set (isapi stuff). After creating a new default MVC3 app and deploying it to the iis6 website that works so there must be something different with the build? The build specifies any cpu. The application pool, the website and the virtual directory all specify .net4. We can't update iis and we can't change servers. Now, I'm out of ideas, any thoughts?
Thanks
Uncheck "Verify that file exists" on the Add/Edit Application Extension Mapping dialog window for your wildcard mapping.

asp.net mvc app in windows 2003 server extension less runs only home page

I've setup an asp.net mvc app on a windows server 2003 machine with IIS6. ASP.NET MVC3 and .NET4 framework has been installed.
Now, I setup a New Website, New AppPool for .NET4 and then put a virtual directory under there with my asp.net mvc3/razor app. So:
IIS
+NewSite <<I set home directory to MyApp
++MyApp/ <<virtual dir
Here is the annoying bit, when I navigate to the address http://<MyServerIp>/ the home page for my app loads up. But, all other links/urls fail and give me a 404.
Like if I click Log On. The URL <myServerIp>/Account/LogOn gives a 404. Similarly all other urls other than the home page give me a 404.
I've gone through as many related questions on SO. I've gone through Phil Haacks article. I've setup a wildcard mapping for .net4.
Any ideas?
Make sure that .NET 4.0 is enabled in the web service extensions folder in IIS manager console:
Also make sure that ASP.NET is properly registered with IIS:
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

MVC site deployed to IIS 7 Homepage work All other page 404

I'm trying to deploy a MVC 3 site to IIS 7.5. The deafult route works but all links return a 404 error including if I manually enter the link for the homepage.
Details:
MVC 3 to IIS 7.5
Windows Server 2008 R2
MVC 3 is installed on server
Default Web Site/PaedPhysiotherapy_Uat
.net 4 is installed
DeafultApplicationPool used
App pool is .net4 and running in integrated mode
Custom error are turned off
If I deploy to a new website on the same IIS box using different ports, e.g. "http://newsite:81 which not under the default website everything works fine.
Even in the absence of routing, IIS will redirect requests for "/" to "/Default.aspx". In an MVC app, there's a Default.aspx which manually finds the MVC handler and invokes it. So that's probably why your home link works.
Your other pages must go through routing. In integrated mode there must be an IIS handler for this. Check the ExtensionlessUrlHandler in the IIS handler mappings. Compare that and other handlers with the sites which work.
At a guess, if this works when deploying to the root of a site then it looks like an absolute path has sneaked in. Perhaps somewhere this is a missing ~ in front of a path e.g.
/MyController
instead of
~/MyController
Also, you did remember to convert /PaedPhysiotherapy_Uat to an application?

asp.net mvc - site works fine locally but not after deployment

i have an asp.net mvc website. http:/mywebsite.com (just for this example)
I have been testing this asp.net mvc website locally on my machine and everything works fine on my local machine during testing. When i deploy to my web server
when i bring up http://mywebsite.com it goes to HomeController and load the view Views/Home/Index.aspx (which is perfect). So the main default page is fine.
The issue is, if i click any other other links (again that all seem to work fine locally) i get the following error:
The page cannot be found
The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.
Please try the following:
* Make sure that the Web site address displayed in the address bar of your browser is spelled and formatted correctly.
* If you reached this page by clicking a link, contact the Web site administrator to alert them that the link is incorrectly formatted.
* Click the Back button to try another link.
HTTP Error 404 - File or directory not found.
Internet Information Services (IIS)
some examples would be:
http:/mywebsite.com\Photos
http:/mywebsite.com\Links
there definitely are controllers and views setup for this (or it wouldn't work locally).
does anyone have any idea how this might work fine locally but somehow on the webserver it doesn't
Are you running the site on II7 in integrated mode? If not, you need to add a wildcard handler so that all URLs get mapped to your application. See Phil Haack's blog post on running ASP.NET MVC ON IIS 6.
Something else to watch out for. I had a static website - deployed on IIS 7.5. Added some MVC Controllers to handle some simple server side apps and then re-deployed it. I didn't copy the web.config file, because I wrongly assumed that everything that was needed was in the one that was automatically created by the server.
You must copy the web.config up as well.

Resources