Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

asp.net 4 routing not working in iis 7

I'm using asp.net 4 routing in one of our new product and it works fine in the development environment (Visual studio webserver). but when i moved it to remote iis for testing purpose it doesn't work. all i get is 404 error page. i tried adding the following to the web.config and still getting the error.

<system.webServer>
     <modules runAllManagedModulesForAllRequests="true">    
     <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
     </modules> 
 <validation validateIntegratedModeConfiguration="false" />
</system.webServer>

any ideas how to sort this issue?.

like image 394
Aneef Avatar asked Dec 13 '10 11:12

Aneef


2 Answers

i got the solution for this ... add the below code in ur web.config .. and dont forget to add runAllManagedModulesForAllRequests="true" in your module..

   <system.webServer> 
        <modules runAllManagedModulesForAllRequests="true"> 
          <remove name="UrlRoutingModule"/> 
          <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> 
        </modules> 
        <handlers> 
          <add 
            name="UrlRoutingHandler" 
            preCondition="integratedMode" 
            verb="*" path="UrlRouting.axd" 
            type="System.Web.HttpForbiddenHandler, System.Web,  
              Version=2.0.0.0, Culture=neutral,  
              PublicKeyToken=b03f5f7f11d50a3a"/> 
        </handlers> 
      </system.webServer>
like image 151
Suraj Sharma Avatar answered Oct 24 '22 23:10

Suraj Sharma


Note: You have to set Application Pool to Asp.net 4.0 application pool , as routing is not working with Asp.net 4.0 Classic Application pool.

like image 37
Kiarash Avatar answered Oct 24 '22 22:10

Kiarash