locked
ASP.NET MVC 3 Global.asax on IIS 7 RRS feed

  • Question

  • I'm having some problems getting IIS 7 to use the Global.asax routing rules.  It appears that it is not using this file whatsoever.  Can IIS 7 run a MVC 3 application without the Global.asax routing rules?

    If I create a new project on my Windows 7 machine using Visual Studio 2010 Express with IIS Express and publish the project to my Windows 2008 production server the default home, about and account pages all work fine and their routing works as well.

    The problem is when I try to create a new controller on the 2008 machine I get 404 errors.  Any controller I create on my development machine before publishing to the production server will work fine.  I just cannot create new controllers after it has been published to  the production server.  Also, none of my custom routing in RouteCollection are working.

    Another thing that seems strange is that if I comment out the entire Global.asax.cs and rebuild the application nothing changes.  The site continues to work even though I thought it would not run without using the rules in the Global.asax.cs file.

    I am using Integrated mode for the application.  I tried Classic but then nothing seemed to work.

    I've also confirmed my web.config has:

      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true" />
      </system.webServer>

    I'm new to MVC but it seems to me that this is an IIS configuration issue on my production server.  

    Thanks!


    • Edited by Cory Clough Tuesday, February 28, 2012 3:35 PM
    • Moved by Lie You Thursday, March 1, 2012 5:54 AM ASP.Net and MVC related. (From:Visual C# Express Edition)
    Tuesday, February 28, 2012 3:33 PM

Answers

  • Hello Cory Clough,

    I'm having some problems getting IIS 7 to use the Global.asax routing rules.  It appears that it is not using this file whatsoever.  Can IIS 7 run a MVC 3 application without the Global.asax routing rules?

    If I create a new project on my Windows 7 machine using Visual Studio 2010 Express with IIS Express and publish the project to my Windows 2008 production server the default home, about and account pages all work fine and their routing works as well.

    The problem is when I try to create a new controller on the 2008 machine I get 404 errors.  Any controller I create on my development machine before publishing to the production server will work fine.  I just cannot create new controllers after it has been published to  the production server.  Also, none of my custom routing in RouteCollection are working.

    Another thing that seems strange is that if I comment out the entire Global.asax.cs and rebuild the application nothing changes.  The site continues to work even though I thought it would not run without using the rules in the Global.asax.cs file.

    I am using Integrated mode for the application.  I tried Classic but then nothing seemed to work.

    I've also confirmed my web.config has:

      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true" />
      </system.webServer>

    I'm new to MVC but it seems to me that this is an IIS configuration issue on my production server. 

    Thanks!


    Welcome to Msdn Forum , for Asp Net question is avialible dedicated Forum , see link below  http://forums.asp.net/

    Best Regards.


    • Proposed as answer by Just Karl Wednesday, January 15, 2014 4:17 PM
    • Marked as answer by Just Karl Thursday, January 23, 2014 10:58 PM
    Tuesday, February 28, 2012 6:46 PM

All replies

  • Hello Cory Clough,

    I'm having some problems getting IIS 7 to use the Global.asax routing rules.  It appears that it is not using this file whatsoever.  Can IIS 7 run a MVC 3 application without the Global.asax routing rules?

    If I create a new project on my Windows 7 machine using Visual Studio 2010 Express with IIS Express and publish the project to my Windows 2008 production server the default home, about and account pages all work fine and their routing works as well.

    The problem is when I try to create a new controller on the 2008 machine I get 404 errors.  Any controller I create on my development machine before publishing to the production server will work fine.  I just cannot create new controllers after it has been published to  the production server.  Also, none of my custom routing in RouteCollection are working.

    Another thing that seems strange is that if I comment out the entire Global.asax.cs and rebuild the application nothing changes.  The site continues to work even though I thought it would not run without using the rules in the Global.asax.cs file.

    I am using Integrated mode for the application.  I tried Classic but then nothing seemed to work.

    I've also confirmed my web.config has:

      <system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
        <modules runAllManagedModulesForAllRequests="true" />
      </system.webServer>

    I'm new to MVC but it seems to me that this is an IIS configuration issue on my production server. 

    Thanks!


    Welcome to Msdn Forum , for Asp Net question is avialible dedicated Forum , see link below  http://forums.asp.net/

    Best Regards.


    • Proposed as answer by Just Karl Wednesday, January 15, 2014 4:17 PM
    • Marked as answer by Just Karl Thursday, January 23, 2014 10:58 PM
    Tuesday, February 28, 2012 6:46 PM
  • Hello,

    You could also ask on http://forums.iis.net/

    Karl


    When you see answers and helpful posts, please click Vote As Helpful, Propose As Answer, and/or Mark As Answer.
    My Blog: Unlock PowerShell
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ('6F6C646B61726C40686F746D61696C2E636F6D'-split'(?<=\G.{2})'|%{if($_){[char][int]"0x$_"}})

    • Proposed as answer by Just Karl Wednesday, January 22, 2014 4:49 AM
    Wednesday, January 15, 2014 4:18 PM