<p>What is the best way to get hosting of an ASP.NET MVC application to work on IIS 5 (6 or 7). When I tried to publish my ASP.NET MVC application, all I seemed to get is 404 errors. I've done a bit of googleing and have found a couple of solutions, but neither seem super elegant, and I worry if they will be unusable once I come to use a shared hosting environment for the application.</p>

<p><a href="http://blogs.microsoft.co.il/blogs/dorony/archive/2007/12/15/using-asp-net-mvc-on-iis-5.aspx" rel="nofollow noreferrer">Solution 1</a></p>

<blockquote>
  <ol>
  <li>Right-click your application virtual directory on inetmgr.exe.</li>
  <li>Properties->Virtual Directory Tab-> Configuration.</li>
  <li>Add a new mapping extension. The extension should be .*, which will be
  mapped to the Executable
  C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,
  or the appropriate location on your
  computer (you can simply copy this
  from the mapping for .aspx files). On
  the mapping uncheck "check that file
  exists".</li>
  <li>3 X OK and you're good to go.</li>
  <li>If you want, you can apply this setting to all your web sites. In
  step1, click on the "Default Web Site"
  node instead of your own virtual
  directory, and in step 2 go to the
  "Home Directory" tab. The rest is the
  same.</li>
  </ol>
</blockquote>

<p>It seems a tad hacky to route everything through ASP.NET.</p>

<p><a href="http://blog.pagedesigners.co.nz/?p=29" rel="nofollow noreferrer">Solutions 2</a></p>

<p>Edit the MVC routing to contain .mvc in the URL and then follow the steps in solution 1 based around this extension. <em>Edit: The original image link was lost, but here it is from Google's Cache:</em></p>

<p><img src="https://i.stack.imgur.com/TDp4F.png" alt="alt text"></p>

[{'answer_id': 57724, 'author': 'Iain Holder', 'author_id': 1122, 'author_profile': 'https://Stackoverflow.com/users/1122', 'pm_score': 1, 'selected': False, 'text': '<p>Have you tried adding .aspx to the end of the controller name?</p>\n\n<p>It worked for Stack Overflow question <em><a href="https://stackoverflow.com/questions/32757/where-can-i-get-asp-mvc-hosting">Where can I get ASP.NET MVC hosting?</a></em>.</p>\n'}, {'answer_id': 57738, 'author': 'Dan', 'author_id': 230, 'author_profile': 'https://Stackoverflow.com/users/230', 'pm_score': 5, 'selected': True, 'text': '<p>Answer is <a href="http://forums.asp.net/p/1239943/2294813.aspx" rel="nofollow noreferrer">here</a></p>\n\n<blockquote>\n  <p>If *.mvc extension is not registered\n  to the hosting , it will give 404\n  exception. The working way of hosting\n  MVC apps in that case is to modify\n  global.asax routing caluse in the\n  following way.</p>\n  \n  <p>routes.Add(new\n  Route("{controller}.mvc.aspx/{action}",\n  new MvcRouteHandler()) {\n      Defaults = new RouteValueDictionary (new{ controller\n  = "YourController"} ) });</p>\n  \n  <p>In this way all your controller\n  request will end up in *.mvc.aspx,\n  which is recognized by your hosting.\n  And as the MVC dlls are copied into\n  your local bin , no special setttings\n  need to be done for it.</p>\n</blockquote>\n'}, {'answer_id': 57740, 'author': 'Tyler', 'author_id': 5642, 'author_profile': 'https://Stackoverflow.com/users/5642', 'pm_score': 3, 'selected': False, 'text': '<p>I think <strong>either way you\'ll have to do Solution 1</strong>.</p>\n\n<p>Consider the HTTP Request pipeline.</p>\n\n<ol>\n<li>A request comes into IIS.</li>\n<li>IIS checks port/host header to see if it has a web site set up to capture requests for that host header/port.</li>\n<li><strong>IIS investigates the file extension of the request (.php, .asp, .aspx) and hands it off to an ISAPI  that can handle that type of request.</strong></li>\n</ol>\n\n<p><strong>Only at this point does ASP.NET (or a PHP runtime) kick in.</strong> If IIS does\'t have that mapping then it\'ll never hand off the request to the ASP.NET runtime and the request will never reach your code. That\'s why you need that glob (*) mapping to the ASP.NET ISAPI. </p>\n\n<p>ASP.NET MVC framework urls often end with no file extension at all. If you want these requests to get handled by ASP.NET (or some other runtime) you have to map all requests regardless of the file extension to that ISAPI (ie. aspnet_isapi.dll). </p>\n\n<p>This is often also done for HttpHandlers that need to serve off media like .jpg, .gif. For the handler to be hit it needs to get mapped to your code even though .jpg isn\'t a "normal" ASP.NET file extension.</p>\n\n<p>HTH,<br>\nTyler</p>\n'}, {'answer_id': 870069, 'author': 'Eric Brown - Cal', 'author_id': 86431, 'author_profile': 'https://Stackoverflow.com/users/86431', 'pm_score': 1, 'selected': False, 'text': "<p>FYI:On server 2003 (developing an app that had to connect to the RPS), it didnt' allow me to add the extension .*, I used the alternate solution modifying the route clause, and that \nworked.</p>\n"}, {'answer_id': 13281359, 'author': 'ranni rabadi', 'author_id': 914936, 'author_profile': 'https://Stackoverflow.com/users/914936', 'pm_score': 2, 'selected': False, 'text': '<p>Run:\nC:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_isapi.dll -i</p>\n\n<p>This will reset IIS registry settings for aspnet user.</p>\n\n<p>Create the virtual directory:\n1.  Right click on the directory you want to convert</p>\n\n<ul>\n<li>select Properties\n<ol>\n<li>under Directory, select Create.</li>\n<li>under Configuration, select Add.</li>\n<li>for Executable insert:</li>\n</ol></li>\n</ul>\n\n<p>C:\\WINDOWS\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_isapi.dll</p>\n\n<p>for Extension insert: .*</p>\n\n<ul>\n<li><p>uncheck    “Check that file exists”</p></li>\n<li><p>under Documents add entry point file, ie: Default.htm, index.htm,             Global.asax</p></li>\n<li><p>under Directory Settings</p>\n\n<ol>\n<li>select Edit...</li>\n<li>select Anonymous access</li>\n<li>uncheck Allow IIS to control password</li>\n<li>uncheck Basic authentication</li>\n<li>uncheck Integrated Windows authentication</li>\n<li>under ASP.NET, make sure version = v4.0.30319</li>\n</ol></li>\n</ul>\n\n<p>TAKE NOTE of User Name ie: IUSR_AVSJ82S    </p>\n\n<p>Set sharing permission of physical directory:</p>\n\n<ul>\n<li>In windows explorer, go to the physical directory that was converted to a virtual directory.\nRight click the directory name</li>\n<li>select properties</li>\n<li>under security tab, select Add</li>\n<li>enter the IIS User name ie: IUSR_AVSJ82S click check name.</li>\n<li>click OK</li>\n<li>set permissions to Read and Write.</li>\n</ul>\n'}]
['https://Stackoverflow.com/questions/57712', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/230/']