ASP.NET MVC on IIS 6 Walkthrough

asp.net mvc, asp.net 0 comments suggest edit

UPDATE: If you run ASP.NET MVC on IIS 6 with ASP.NET 4, setting up extensionless URLs just got easier. In most cases, it should just work.

I’ve seen a lot of reports where people have trouble getting ASP.NET MVC up and running on IIS 6. Sometimes the problem is a very minor misconfiguration, sometimes it’s a misunderstanding of how IIS 6 works.

In this post, I want to provide a definitive guide to getting ASP.NET MVC running on IIS 6. I will walk through using the .mvcor .aspx file extension for URLs first, then I will walkthrough using extension-less URLs.

If you’re running into problems with IIS 6 and ASP.NET MVC, I recommend trying to walk through all the steps in this post, even if you’re not interested in using the .mvcor.aspx mapping. Some of the lessons learned here have more to do with how ASP.NET itself works with IIS 6 than anything specific to ASP.NET MVC.

Initial Setup

To make this easy, start Visual Studio and create a new ASP.NET MVC Web Application Projecton the machine with IIS 6. If your IIS 6 machine is on a different machine, you can skip this step. We can deploy the site to the machine later.

After you create the project, right click the project and select Properties. The project properties editor will open up. Select the Web tab and select Use IIS Web Server.Click on the image for a full size view.

Project Properties
Editor

In the project URL, I gave it a virtual application name of Iis6DemoWeb and then checked Create Virtual Directory. A dialog box should appear and you should now have an IIS virtual application (note this is different than a virtual directory, as indicated by the gear looking icon) under your Default Web Site.

IIS 6 Virtual Web
Application

Using a URL File Extensions

When you run the ASP.NET MVC installer, it will set up an ISAPI mapping in IIS 6 to map the .mvc extension to the aspnet_isapi.dll. This is necessary in order for IIS to hand off requests using the .mvc file extension to ASP.NET.

If you’re planning to use extension-less URLs, you can skip this section, but it may be useful to read anyways as it has some information you’ll need to know when setting up extension-less URLs.

Mapping .mvc to ASP.NET

If you plan to use the .mvc URL extension, and are going to deploy to IIS 6 on a machine that does not have ASP.NET MVC installed, you’ll need to create this mapping by performing the following steps.

One nice benefit of using the .aspx extension instead of .mvc is that you don’t have to worry about mapping the .aspx extension. It should already be mapped assuming you have ASP.NET installed properly on the machine.

For the rest of you, start by right clicking on the Virtual Application node (IIS6DemoWeb in this case) and select Properties. You should see the following dialog.

Website
Properties

Make sure you’re on the Virtual Directory tab and select Configuration. Note that you can also choose to make this change on the root website, in which case the tab you’re looking for is Home Directory not Virtual Directory.

This will bring up the Application Configuration dialog which displays a list of ISAPI mappings. Scroll down to see if .mvc is in the list.

application
mappings

In the screenshot, you can see that .mvc is in the list. If it is in the list on your machine, you can skip ahead to the next section. If it’s not in the list for you, let’s add it to the list. You’re going to need to know the path to the aspnet_isapi.dll first. On my machine, it is:

c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll

It might differ on your machine. One easy way to find out is to find the .aspx extension in the list and double click it to bring up the mapping dialog.

extension
mapping

Now you can copy the path in the Executable text box to your clipboard. This is the path you’ll want to map .mvc to.

Click Cancel to go back to the Application Configuration dialog and then click Addwhich will bring up an empty Add/Edit Application Extension Mapping dialog.

Fill in the fields with the exact same values as you saw for .aspx, except the extension should be “.mvc” without the quotes. Click OK and you’re done with the mapping.

Specifying Routes with an Extension

Before we run the application, we need to update the default routes to look for the file extension we chose, whether it be .mvc or .aspx extension. Here is the RegisterRoutes method in my Global.asax.cs file using the .mvc extension. If you want to use the .aspxextension, just replace {controller}.mvc with {controller}.aspx.

public static void RegisterRoutes(RouteCollection routes)
{
  routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

  routes.MapRoute(
    "Default",
    "{controller}.mvc/{action}/{id}",
    new { action = "Index", id = "" }
  );

  routes.MapRoute(
    "Root",
    "",
    new { controller = "Home", action = "Index", id = "" }
  );
}

Note that because the second route, “Default”, has a literal extension as part of the URL segment, it cannot match a request for the application root. That’s why I have a third route named “Root” which can match requests for the application root.

Now, I can hit CTRL+F5 (or browse my website) and I should see the following home page.

Home
Page

And about page.

About
Page

Notice that the URLs contain the .mvc extension.

Uh oh, Houston! We have a problem

Of course, you’re going to want to be able to navigate to the web root for your project. Notice what happens when you navigate to /Iis6DemoWeb.

Root Home
Page

This is a bug in the Default.aspx.cs file included with our default template which I discovered as I was writing this walkthrough. We’ll fix it right away, but I can provide the fix here as it’s insanely easy.

Note: If you received a File Not Found error when visiting the root, then you might not have Default.aspx mapped as a default document. Follow these steps to add Default.aspx as a default document.

As I’ve written before, this file is necessary for IIS 6, IIS 7 Classic Mode, and pre SP1 Cassini, but not IIS 7 Integrated. So if you’re using Cassini with Visual Studio 2008 SP1 and deploying to IIS 7 Integrated, you can delete Default.aspx and its sub-files.

In the meanwhile, the fix is to make the following change.

Change:

HttpContext.Current.RewritePath(Request.ApplicationPath);

To

HttpContext.Current.RewritePath(Request.ApplicationPath, false);

If you created your website in the IIS root rather than a virtual application, you would never have noticed this issue. But in the virtual application, the URL to the stylesheet rendered contained the virtual application name, when it shouldn’t. Changing the second argument to false fixes this.

IIS6 Extension-less URLs

Ok, now we’re ready to try this with extension-less URLs using the infamous “Star mapping” or “Wildcard mapping” feature of IIS 6. I say infamous because there is a lot of concern over the performance implications of doing this. Of course, you should measure the performance of your site for yourself to determine if it is really a problem.

The first step is to go back to the Application Configuration Properties dialog like we did when configuring the .mvc ISAPI mapping (see, I told you that information might come in useful later).

application
mappings

Next to the Wildcard application maps section, click the Insert… button.

wildcard extension
mapping

This brings up the wildcard application mapping dialog. Enter the path to the aspnet_isapi.dll. You can follow the trick we mentioned earlier for getting this path.

Don’t forget to uncheck the Verify that file exists checkbox! This is one of the most common mistakes people make.

If you’ve been following along everything in this post, you’ll need to go back and reset the routes in your Global.asax.cs file to the default routes. You no longer need the .mvc file extension in the routes. At this point, you can also remove Default.aspx if you’d like. It’s not needed.

Now when you browse your site, your URLs will not have a file extension as you can see in the following screenshots.

Home page without
extension

About page without
extension

 

Final Tips

One thing to understand is that an ASP.NET project is scoped to the Website or Virtual Application in which it resides. For example, in the example I have here, we pointed a Virtual Application named IIS6DemoWeb to the directory containing my ASP.NET MVC web application.

Thus, only requests for that virtual application will be handled by my web application. I cannot make a request for http://localhost/ in this case and expect it to be handled by my application. Nor can I expect routing in this application to handle requests for another root directory such as http://localhost/not-my-app/.

This might seem like an obvious thing to say, but I know it trips some people up. Also, in the example I did here, I used a virtual application for demonstration purposes. It’s very easy to point a root Website in IIS to my application and run it in http://localhost/ rather than a virtual application. This is not a problem. I hope you found this helpful.

Found a typo or error? Suggest an edit! If accepted, your contribution is listed automatically here.

Comments

avatar

93 responses

  1. Avatar for huey
    huey November 26th, 2008

    Good to know the url problem when looking at the root request was a bug with Default.aspx.cs that is going to be fixed. I have been using Url.Content everywhere instead which can get ugly. For instance after the SP1 jquery patch I had two links to jquery -- one with url.content that didn't provide intellisense but would work when deployed, and another wrapped in a if(false) block just to provide intellisense.

  2. Avatar for xulijie
    xulijie November 26th, 2008

    THANK YOU VERY MUCH,i CAN DO IT NOW

  3. Avatar for Martin
    Martin November 26th, 2008

    thanks. this info is very helpful

  4. Avatar for Mike
    Mike November 26th, 2008

    An alternative I like is to map .asp to ASP.NET MVC. If you don't use Classic ASP that extension should be available. It would look like this:
    http://example.com/products.asp/detail/25

  5. Avatar for Brian Lowe
    Brian Lowe November 26th, 2008

    It's all very well talking about mapping extensions to get IIS to handle the requests, but I expect lots of developers will be using shared hosting and have no access to the IIS mapping table. In this scenario the olny option is to make sure all of your routes include an extension that is already mapped to thee ASP.Net runtime under the default IIS set-up (.aspx is a sure thing but there are others).
    Also, the default page configured under IIS (usually including default.aspx) must implement the necessary redirect code to get the initial route into the visitor's view...
    public void Page_Load(object sender, System.EventArgs e)
    {
    HttpContext.Current.RewritePath(Request.ApplicationPath);
    IHttpHandler httpHandler = new MvcHttpHandler();
    httpHandler.ProcessRequest(HttpContext.Current);
    }

  6. Avatar for Steve
    Steve November 26th, 2008

    Good post - thanks Phil!

  7. Avatar for Mitch
    Mitch November 26th, 2008

    One of the things that tripped me up at first when manually adding the .mvc extension was that I was not leaving the verify the files exists checkbox unchecked. It seems obvious, but for some reason it made waste some time running the problem down.
    Thanks,
    Mitch

  8. Avatar for alik levin
    alik levin November 28th, 2008

    great post!
    thanks for sharing it, very helpful to bootstrap with MVC/IIS.

  9. Avatar for Shaun Trennery
    Shaun Trennery December 1st, 2008

    There is a problem with AntiForgeryToken in MVC Futures and running under a virtual directory in IIS6. I get the following error:
    "The virtual path '/DummyUrl' maps to another application, which is not allowed"

  10. Avatar for prabhjot singh
    prabhjot singh December 2nd, 2008

    Sir, i have used this method, but i am facing scalability problem, i want to use the 404 approach of extension less routing. i have implemented everything i.e. i have written the required code for 404 in the global file and changed the IIS6 settings at the time of deployment. but it is still throwing the " Resource cannot be found" error.
    what should i do??
    Regards
    Prabhjot Singh

  11. Avatar for Gordon Bergling
    Gordon Bergling December 2nd, 2008

    Thank you for that Guide...

  12. Avatar for Luke Venediger
    Luke Venediger December 2nd, 2008

    Thanks Phil!!! Yay! No more .mvc extensions in my routes.

  13. Avatar for Brien
    Brien December 2nd, 2008

    Don't forget that in a basic IIS install, ASP.NET is turned off. You need to go into the IIS Web Service Extensions and enable ASP.NET.
    I fought with IIS for a few days before I realized my mistake.

  14. Avatar for venu
    venu December 3rd, 2008

    hi,
    How to configure IIS 6.0 + HTTPS + Mvc Preview 3
    reply as soon as possible
    thanking you

  15. Avatar for haacked
    haacked December 3rd, 2008

    @venu sorry, but we don't support ASP.NET MVC Preview 3. I suggest you upgrade to the Beta.

  16. Avatar for Venu
    Venu December 4th, 2008


    hi haacked,
    Thanks for the Reply.
    Now i'm using MVC Beta and i publish the application like
    http://localhost/MVCTest
    If i run the application from the solution then i can access all pages like Home ,About and
    Login Page.
    But when i access the link [http://localhost/MVCTest] from IIS or IE, i can access only Home
    page.If I'm trying to access About page or Login page it shows "The page cannot be found".
    What can i do to access the About and Login page from IIS or IE ?
    Reply Immediately.
    by,
    Venu

  17. Avatar for Michael Knopf
    Michael Knopf December 7th, 2008

    Thanks for the info, I am familiar with using the wildcard mapping as this was necessary in an app i wrote that used URL re-writing but I find the IIS Virtual "Application" as opposed to directory interesting. Thanks again Haack, your posts are invaluable

  18. Avatar for Mats Jakobsson
    Mats Jakobsson December 9th, 2008

    Beautiful! You really made my day with this walkthrough! Thanks a lot!

  19. Avatar for Eric Polerecky
    Eric Polerecky December 9th, 2008

    I do not have wildcard mappings available on this version of XP.
    First, is there a service pack or otherwise update to IIS for XP?
    Second, I added a * mapping under application mappings...with worked to remove the .mvc extension...but breaks my web services
    The HTTP verb POST used to access path 'Web site name' is not allowed

    Any hints?

  20. Avatar for Tauqeer
    Tauqeer December 10th, 2008

    Thanks for the great post

  21. Avatar for Rey
    Rey December 14th, 2008

    Hi ,
    I just deployed the sample MVC project into my website http://classifieds.arabeastern.com/ , The home page is working fine. All the links other than home page throw a page not found error. I had added the .mvc to the application configuration and unchecked "Verify the file exist" option.
    Anyone please help me to get rid of this error
    Home page url : http://classifieds.arabeastern.com/
    Thank you.

  22. Avatar for Hasan Ozdil
    Hasan Ozdil December 18th, 2008

    I have the same problem than Rey.
    Thx for any help.
    Hasan

  23. Avatar for Dan
    Dan January 4th, 2009

    Hi,
    Great walk through! I have one issue though. All is currently working well on my localhost server but when I attempt to view the page from another computer on my network, I receive the connect to computer pop up asking me to login as a guest and if I hit ok or cancel the webpage looks as if no style sheet has been applied (just like in the Uh oh, Houston! We have a problem screenshot)
    Do you have any ideas how to remove this authorisation popup and allow the site to display as intended?
    Kind regards,
    Dan

  24. Avatar for OscarD
    OscarD January 8th, 2009

    Rey, Hasan Ozdil :
    You just forgot to do this step "IIS6 Extension-less URLs"
    Adding the infamous “Star mapping” or “Wildcard mapping”
    for Extension-less URLs

  25. Avatar for MUQSIT MUJAWAR
    MUQSIT MUJAWAR January 27th, 2009

    It's all very well talking about mapping extensions to get IIS to handle the requests, but I expect lots of developers will be using shared hosting and have no access to the IIS mapping table. In this scenario the olny option is to make sure all of your routes include an extension that is already mapped to thee ASP.Net runtime under the default IIS set-up (.aspx is a sure thing but there are others).
    Also, the default page configured under IIS (usually including default.aspx) must implement the necessary redirect code to get the initial route into the visitor's view...
    public void Page_Load(object sender, System.EventArgs e)
    {
    HttpContext.Current.RewritePath(Request.ApplicationPath);
    IHttpHandler httpHandler = new MvcHttpHandler();
    httpHandler.ProcessRequest(HttpContext.Current);
    }

    MUQSIT MUJAWAR

  26. Avatar for Venu
    Venu January 27th, 2009

    hi,
    How to Configure Asp.net MVC Beta + Windows server 2008 + IIS 7.0 + PUT,DELETE Verb.

  27. Avatar for James Fisk
    James Fisk February 2nd, 2009

    Thank you very much. I just upgraded to MVC RC and it just stopped working. This blog saved me a lot of hassle. It's all good now.

  28. Avatar for toddo
    toddo February 6th, 2009

    Hi, Trying to use file extension method with forms authentication and have authorization set to deny users="?" and I am getting "The page cannot be found" when I try to browse it and the URL changes to:
    localhost/.../Login
    I changed my RegisterRoutes() like below and have Default.aspx listed as a default document. What could I be missing?
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    routes.MapRoute(
    "Default", // Route name
    "{controller}.aspx/{action}/{id}", // URL with parameters
    new { controller = "Home", action = "Index", id = "" } // Parameter defaults
    );
    routes.MapRoute(
    "Root",
    "",
    new { controller = "Home", action = "Index", id = "" }
    );

  29. Avatar for Vasanth
    Vasanth March 23rd, 2009

    Hi,
    I have followed this article to remove the extension. I have added .aspx insteadof .mvc in my routing. I am not able to remove the .aspx from the url.
    I am using IIS6.0. But I dont know what may be the probs....
    pls give me the solution....

  30. Avatar for Carl
    Carl March 26th, 2009

    thank you SO much for sharing this article, Phil! My MVC application works fine with my host and I am excited and enthusiastic to wait for your next post.
    Keep up the good work, mate!!

  31. Avatar for Wayne
    Wayne March 26th, 2009

    Everything works perfectly!!! I have tried my MVC site on both IIS6 and IIS7 with my current host (http://www.asphostcentral.com) and they are all working fine. I am really grateful with this well-written article and I certainly hope it will help the other community members in getting up their first MVC site.
    Believe me, this technology is just amazing!!

  32. Avatar for Sid
    Sid December 16th, 2009

    I have followed this set of instructions closely. However, when I view my site in browser on the server as //localhost/domainname/ there's no styling, despite the fact that default.aspx.vb already has HttpContext.Current.RewritePath(Request.ApplicationPath, False). Is there something else I need to change?
    Thanks!

  33. Avatar for Dmitry
    Dmitry December 20th, 2009

    I've just finished the detailed article on how to enable extensionless URLs in MVC under IIS 6 with postbacks working!
    Hope it will be helpful for those who want nice URLs in MVC application under IIS 6.
    Article link.

  34. Avatar for Modem56k
    Modem56k January 7th, 2010

    thank for the walkthough.. i did run into an issue with the wildcard. I am using Visual Studio 2008 Express, with the wildcard in place i am unable to publish my Site to the Server? have you run into this issue?

  35. Avatar for Babak
    Babak January 9th, 2010

    Thanks Phil,
    Finally something that works...
    Thanks!
    Babak

  36. Avatar for Max
    Max January 12th, 2010

    Hello,
    Thank you for this "easy to follow" walkthrough. However, nothing seems to work the way you describe it. I am using visual web developer express 2010, and I'm trying to deploy my app on a windows 2003 server with IIS 6 (wich I have control over). Is this combination not possible or what?
    best regards
    /Max

  37. Avatar for DARWIN
    DARWIN February 1st, 2010

    Do the have the script for this?

  38. Avatar for Tim
    Tim February 5th, 2010

    In MVC 2 RC2 I found the following changes needed to be made relative to this article if you go with the wildcard strategy.
    * Remove the .mvc Extension handler
    * Remove the .mvc from your Default Route ({controller}.mvc)
    The web.config in the new version already registers for the .mvc it seems and does the right thing.

  39. Avatar for Lluis Arevalo
    Lluis Arevalo February 10th, 2010

    Thanks a lot fot this post! It solve my problem, :-)

  40. Avatar for Olav Rask
    Olav Rask February 11th, 2010

    Great stuff - the exact issue i was running into as well!

  41. Avatar for Cheeso
    Cheeso March 24th, 2010

    Excellent walkthrough. Regarding extension-less MVC on IIS6 - you can use a URL rewriter to accomplish this, without the performance concern. For example, http://iirf.codeplex.com

  42. Avatar for Mark
    Mark April 13th, 2010

    With .NET 4, it is no longer required to add an isapi wildcard mapping to get extension-less urls working on IIS6.
    For further info, read this post: blogs.msdn.com/...
    I had been testing an MVC2 app on Windows 2003 server when I suddenly realised I hadn’t set up the wildcard mapping, yet the extension-less url routing was working perfectly. After some testing, I found out that changing the .net framework back to v2 for the web application meant the routing failed.
    After much searching to see if .NET 4 has a new feature, I came across the above link. This was feature I had not heard a whisper of, but which needs to be highlighted.

  43. Avatar for Phuoc Doan
    Phuoc Doan May 10th, 2010

    Hi Everyone,
    * I have IIS 6 installed on my x64 windows server 2003
    * With my website host in IIS 6:
    + I've setup Application Extension Mapping for .mvc is "C:\WINDOWS\microsoft.net\Framework64\v2.0.50727\aspnet_isapi.dll" and uncheck Verify that file exists
    + I've also setup Wildcard App Map used above path and uncheck Verify that file exists too
    * and below is my route:
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
    routes.MapRoute(
    "Default", // Route name
    "{controller}/{action}/{id}", // URL with parameters
    new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
    );
    When I browse my website, it return the blankpage.
    Please help me what's wrong with my works.
    Many thanks

  44. Avatar for Pedro Rui Silva
    Pedro Rui Silva May 16th, 2010

    Brilliant, saved me a lot of precious time.
    Many thanks.

  45. Avatar for Francois Viljoen
    Francois Viljoen May 24th, 2010

    Thank-you. Your article saved me a lot of headaches.

  46. Avatar for Erik Burger
    Erik Burger May 24th, 2010

    As an additional tip, please make sure you pick the correct version of aspnet_isapi.dll when you are running a 64-bit version of Windows/IIS. Sounds obvious but trust me, it'll give you a major headache if you don't.
    Erik

  47. Avatar for Randy
    Randy May 27th, 2010

    What if I have an existing MVC site that I am migrating from another server box? Do I have to set it up as a virtual application as well? Right now, my Lead Designer has it as a website folder (with the little blue globe icon) underneath the Websites folder in IIS. Can I turn this into a virtual application and do the steps in your walkthrough? Thanks.

  48. Avatar for motobineuse
    motobineuse July 1st, 2010

    Thanks to Google i was able to find this great article it really solved my problems thank you again.

  49. Avatar for Ade
    Ade July 13th, 2010

    Thanks, this is the clearest description of how to deploy to IIS6 I've found.

  50. Avatar for Isha
    Isha July 22nd, 2010

    I am not able to call the page with .mvc extension in II7. it works fine without the .mvc. Wats the process for II7

  51. Avatar for Venu
    Venu July 25th, 2010

    Hi,
    How to Configure Asp.net MVC Beta + Windows server 2008 + IIS 7.0 + PUT,DELETE Verb.

  52. Avatar for Shilk
    Shilk August 2nd, 2010

    Hi,
    I need help. I have a .NET 3.5 site hosted in IIS5. Its a ASP and ASP.NET site. When in configuration section while setting up IIS website I add wildcard entry for C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll, and I go to browse my site it gives 404 error for Default.aspx. So if I type in http://localhost:8072/ it doesnt work, but if I type in http://localhost:8072/Default.aspx then it works.
    Any help really appreciated.
    Thanks,
    Shil

  53. Avatar for Brian
    Brian August 18th, 2010

    Hi,
    I added extension(aspx) to my request in my mvc application, it works using VS development server, but when I deploy my app to local IIS or to my the hosting server of my company, I can navigate between differen page, and see the url with .aspx, but when I try to use $.getJSON to send request to server, the request never reach the server, even I put the aspx extension to the request, can anybody tell me what's wrong with my mvc application.
    The code I use to send the request like:
    $.getJSON("/Home.aspx/LoginUser?email=" + email + "&password=" + password, null, function(data) { checkLoginResult(data); });
    and my routing code like:
    public static void RegisterRoutes(RouteCollection routes)
    {
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

    routes.MapRoute(
    "Default",
    "{controller}.aspx/{action}/id}",
    new { action = "Index", id = "" }
    );
    routes.MapRoute(
    "Root",
    "",
    new { controller = "Home", action = "Index", id = "" } );
    }

    thanks

  54. Avatar for Randyu
    Randyu August 19th, 2010

    I walked through the steps in this post and I can get to the home page fine, but no other pages can be found. I do not have access to the Global.asax.cs file to do any editing in it. Don't know what I've missed. This same application is working on a deveiopment server but not on the public server.

  55. Avatar for Ram
    Ram August 30th, 2010

    I am having same issue as Randyu and others who reported. IIS 6 after all the good settings described above, behaves wierd. Only home page comes up , The about link does not work. I get 404 error. I have tried all options reading all blogs thus far.
    No Luck.
    Not sure how I can resolve this issue. Any tips. Again I have followed the wild card settings described about to the T.

  56. Avatar for Thomas Dilts
    Thomas Dilts September 13th, 2010

    Thanks dude. Saved my life. Worked on this about 8 hours by myself and got nowhere. With your help it took about 10 minutes to fix.

  57. Avatar for muzammil ahmed
    muzammil ahmed September 16th, 2010

    Hey,
    thanks for the great post. but i have a problem.
    After i implemented what you have mentioned in your post, my db connection went for a toss. i started getting the following error
    sqlException{"Cannot open database \"BLAHBLAH\" requested by the login. The login failed.\r\nLogin failed for user BLEEHBLEEh\\ASPNET'."}System.Data.SqlClient.SqlException

  58. Avatar for muzammil ahmed
    muzammil ahmed September 17th, 2010

    Hi,
    Forget about my previous post. i got it working.
    But now i have a problem with my website. After making the changes the site is coming up fine and the .mvc files are recognized alright. But it has thrown out of gear my .js script file path. I get object doesnt support this property for all my jquery. Kindly help.

  59. Avatar for kashif Jamil
    kashif Jamil October 14th, 2010

    Hi,
    I published my ASP.NET MVC 2 Web Application with "Only files needed to run this application". After that I create a Virtual Directory on Windows 2003 server (IIS 6) and copy, paste all files (also copied System.Web.Abstractions.dll, System.Web.Extensions.dll, System.Web.Mvc.dll and System.Web.Routing.dll into BIN).
    My published web directory structure is as
    Bin [Folder]
    Content [Folder]
    Models [Folder]
    Scripts [Folder]
    Views [Folder]
    Global.asax
    Web.config
    I followed all the steps you mentioned but I could not run my application, kindly help me to figure out, why it is not working.

    Regards,
    Kashif Jamil

  60. Avatar for qishu2002
    qishu2002 November 22nd, 2010

    I walked through your article and made my sample web site display static content such as Jquery theme, ui, etc.
    However, I can not build connection to remote sql server via IIS 6.0. I can build connection with VS 2008. I have spent lots of time on this issue, still not working. I got error as
    System.Data.SqlClient.SqlInternalConnection.OnError(SQlException exception, Boolean breakConnection)
    Please help on this. I am very frustrated.

  61. Avatar for Dani Kaplan
    Dani Kaplan January 29th, 2011

    Thanks, I'm running dot net 4.0 on iis6 and without the wild card mapping nothing had worked. saved me a lot of time !

  62. Avatar for Sanjay
    Sanjay February 8th, 2011

    Hi
    My site is on mvc2 and when i browse it from dev4.chd.miraclegroup.com/A... sometime it works properly but sometimes it doesn't work show something like directory structure, can anyone tell me the reason.
    THANKS

  63. Avatar for vishal patwardhan
    vishal patwardhan February 18th, 2011

    I use the same solution and this works for me its a great solution you can also find some use full here about this
    www.vishalpatwardhan.com/...

  64. Avatar for Gordon
    Gordon March 1st, 2011

    Do you know of a walk through for IIS 7? I am in permissions hell.

  65. Avatar for geezen
    geezen March 3rd, 2011

    Much like the others I spent hours trying to figure this out, but after following your directions we had it up and running after only a few minutes!

  66. Avatar for Katrina
    Katrina May 6th, 2011

    Hi Phil,
    Thanks for that. Everything displays fine on my website except for one image. This image is dynamically created. So in the view it looks like:

    <img id="pieChartImage" src="/Comment/MoodPieChart" width="350" height="280" alt="" />
    i.e. I expect it to go the CommentController and the method
    public FileContentResult MoodPieChart(string thingToExplode)
    { //generates the desired image
    }
    now when I host it locally on IIS 7.5 it all works fine but when I put it live on IIS6 it just wont display.
    I have even put in a route for it in Global.asax as follows:
    routes.MapRoute(
    "Default3",
    "{controller}/{action}/{id}",
    new { controller = "Comment",
    action = "MoodPieChart",
    id = UrlParameter.Optional }
    );
    If you have a solution for this I will be eternally graetful
    best regards,
    Katrina

  67. Avatar for Bahamut
    Bahamut June 16th, 2011

    Hi,
    I tried this on MVC 3 in IIS 6. I've installed .net 4 and mvc 3 RTM on the machine, set everything to use asp.net 4 and tried the .mvc extensions but it gave me 404. I've even took out the .mvc in the global.asax.cs, built and published it but I ended up with the same result.
    What am I missing? Is this applicable for MVC 3?

  68. Avatar for Perry
    Perry July 28th, 2011

    Hi Phil, thanks for this write up. It helped us take a 'hybrid' sln which contained a legacy WebForms app and a new MVC(2) app, and install it on IIS 6. Now I moved it to IIS 7 and since its still half webform and half MVC(2) I needed to to the *.mvc route and handler mapping to get it to work. Here was my surprise - the handler mapping I made in IIS 7.5 gets blasted away every time I deploy my code! I use msbuild and Web Deploy to automate all this and we just realized, POOF! The handler mapping for *.mvc is gone. Am I correct in assuming I need to write this mapping up in this hybrid apps web.config for it to stick in IIS 7.5 ? If so, do you have a sample of what that looks like?
    Thanks!

  69. Avatar for Travis
    Travis August 8th, 2011

    Have installed MVC 3, asp.net 4 framework on IIS6. Couldn't get the wildcard or .mvc method to work, but it does work with .aspx extension.

  70. Avatar for Bobio
    Bobio September 20th, 2011

    Thank you! your great post helps me to setup my MVC2 project on IIS6. but I skipped "Specifying Routes with an Extension" section and it still works for me.

  71. Avatar for mulderlink7
    mulderlink7 November 22nd, 2011

    Saludos desde México!!!
    Me sirvio de gran ayuda tu post, muchisimas gracias por la información.

  72. Avatar for Lukyw
    Lukyw March 30th, 2012

    Good post!
    but i run into another problem, i used mvc 2 developed on windows xp access the LDAP server for anthentication, it's ok,
    finally when i deployed on IIS5.1 server on xp, throw an exception: DirectoryServicesCOMException (0x8007052e): Logon failure: unknown user name or bad password.
    why is that? any help

  73. Avatar for Andre Juliano
    Andre Juliano April 3rd, 2012

    In my case, I had to set ASP.NET to version 2.0 first and then set it back to 4.0. Only after it the application worked well and I stopped getting "Directory listing denyied" or "Resource can not be found".

  74. Avatar for ARVIND mISHRA
    ARVIND mISHRA April 9th, 2012

    This is very nice article. This helpded me alot to resolve the page not found deployment issue.
    Thanks
    Arvind Mishra

  75. Avatar for jerome
    jerome May 9th, 2012

    good article.
    what about delete verbs..?
    if you wildcard map, there's (apparently) no way of selecting in IIS which verbs are accepted , as allowed verbs are selected in association with an extension?

  76. Avatar for DaMi
    DaMi June 26th, 2012

    Very helpful article!! Thanks :)

  77. Avatar for Jose
    Jose July 18th, 2012

    Hi, i am getting the "HTTP Error 404 - File or directory not found.
    Internet Information Services (IIS)" Any idea?

  78. Avatar for Thien Vo
    Thien Vo September 23rd, 2012

    hi, im using dotnetnuke and get exception:
    Method not found: 'Void System.Web.Mvc.ViewContext..ctor(System.Web.Mvc.ControllerContext, System.Web.Mvc.IView, System.Web.Mvc.ViewDataDictionary, System.Web.Mvc.TempDataDictionary, System.IO.TextWriter)'.
    Message:
    DotNetNuke.Services.Exceptions.PageLoadException: Method not found: 'Void System.Web.Mvc.ViewContext..ctor(System.Web.Mvc.ControllerContext, System.Web.Mvc.IView, System.Web.Mvc.ViewDataDictionary, System.Web.Mvc.TempDataDictionary, System.IO.TextWriter)'. ---> System.MissingMethodException: Method not found: 'Void System.Web.Mvc.ViewContext..ctor(System.Web.Mvc.ControllerContext, System.Web.Mvc.IView, System.Web.Mvc.ViewDataDictionary, System.Web.Mvc.TempDataDictionary, System.IO.TextWriter)'. at DotNetNuke.Framework.ServicesFrameworkImpl.CreateHtmlHelper() at DotNetNuke.Framework.ServicesFrameworkImpl.RegisterAjaxAntiForgery(Page page) at DotNetNuke.Framework.PageBase.OnPreRender(EventArgs e) at DotNetNuke.Framework.DefaultPage.OnPreRender(EventArgs evt) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) --- End of inner exception stack trace ---
    anyone can help me???

  79. Avatar for bradley
    bradley September 24th, 2012

    For all those still getting the "404 page not found error" but can still load up root URL
    As Mr Haack says in this tut, Go back to that isapi mapping, make sure the "Verify file exists" box is UNCHECKED. That one got me for a bit.

  80. Avatar for Lelala
    Lelala October 19th, 2012

    Thanks for pointing out how to enable all the stuff on IIS6 - saved a lot of headache for us :-)
    Regards

  81. Avatar for Hani
    Hani November 16th, 2012

    Hello, nice article, only one problem! i've been bought my hosting plan long time ago and i don't have access to IIS settings. how can i run ASP.NET MVC 4 on IIS 6 or lower?

  82. Avatar for Zayar
    Zayar November 27th, 2012

    When I insert wildcard extension mapping to: "c:\windows\microsoft.net\framework\v4.0.30319\aspnet_isapi.dll" I got server error.
    Any idea?

  83. Avatar for Dark Penguin
    Dark Penguin January 4th, 2013

     Nearly all the fixes for MVC on IIS 6 tell me to right-click on the website node and then click on Properties below that.  There we're supposed to get to a nice Windows dialog box with a bunch of tabs including "Home Directory", which may be called "Virtual Directory" instead.  But it doesn't happen.  I do see a variety of attributes listed in the main, central display area, but there's nothing there which, to my mind, maps to "Home" or "Default" directory.  

    The website in question was built as a Web Application and published using the command under the Build Menu in Visual Studio.  I've also tried doing it with a web deployment package, but either way the website will not run under IIS.  I can't help but wonder why this would be so difficult, when the *code* in Global.asax is supposed to handle the parsing and routing of URLS.

    There must be something simple that I'm overlooking.  Is there any general diagnostic for IIS 6.0 that can tell me what's missing?  For example, how can I tell what level of MVC it can handle?

  84. Avatar for Dark Penguin
    Dark Penguin January 4th, 2013

    ETA:  The project I'm trying to deploy was created as an empty MVC3 project.  FTR it's the SportsStore tutorial app.  So far, everything works fine if I use the internal Visual Studio web server.  I have had other MVC projects work fine in IIS, as well as some that don't, including this one.

  85. Avatar for HerrodFrye
    HerrodFrye January 19th, 2013

    Your post helps us to setup my MVC2 project on IIS6. but we skipped Specifying Routes with an Extension section and it still works for us.

  86. Avatar for Anthony Main
    Anthony Main August 2nd, 2013

    Great article, missing one little tid'bit though for those that might find .net isnt actually working (get 404's). Solution is here:

    http://johan.driessen.se/po...

  87. Avatar for Rajesh S
    Rajesh S October 16th, 2013

    Thanks. Worked for me
    ASP,NET MVC4.0 in IIS6

  88. Avatar for vanquyet
    vanquyet February 11th, 2014

    xam hinh nghe thuat http://kbtattoo.net/

    day xam hinh nghe thuat http://kbtattoo.net/day-xam...

  89. Avatar for Matt
    Matt February 23rd, 2014

    I just want to tell you that you are the bees knees. Thanks so much. You have no idea how much time and headache you just saved me at 11 PM on a Sunday night.

  90. Avatar for Carlos Bueno
    Carlos Bueno February 25th, 2014

    tks ...

  91. Avatar for SAM
    SAM September 16th, 2014

    Wonderful!!!!!!!!!!!!!! Thank you very much and keep your good work up :)

  92. Avatar for Haavard
    Haavard December 18th, 2014

    tyty!!

  93. Avatar for Ashteya
    Ashteya March 16th, 2015

    Almost 7 years later and this post is still helping people. You just saved me a couple of hours of headache with this: Don’t forget to uncheck the Verify that file exists checkbox!