3

i have a webapp which works perfectly when debugged and tested locally. However when I publish the site to a productionserver the routing is messed up. This is because it runs as a sub-project on the productionserver.

Testing:     http://localhost:xxx/
Production:  http://remotehost/webapp/

How should I setup routing?

This is my current routing setup (mostly default). The server displays the default Controller action when I visit http://remotehost/webapp/. But when I hard-code the controller (http://remotehost/webapp/Project/ it doesn't work...

Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
    routes.IgnoreRoute("{resource}.axd/{*pathInfo}")

    routes.MapRoute("ProjectsByCategory", "Project/Category/{id}", _
                    New With {.controller = "Project", .action = "ListByCategory", .id = ""}, _
                    New With {.id = "^[0-9]+"})


    routes.MapRoute( _
        "Default", _
        "{controller}/{action}/{id}", _
        New With {.controller = "Project", .action = "Index", .id = ""} _
    )

End Sub
Ropstah
  • 17,538
  • 24
  • 120
  • 194

2 Answers2

3

To me it sounds like it might be related to publishing on iis 6. There's an article here about that.

For me a similar problem was resolved by adding a 'Wildcard application map':

  • In IIS, right click and choose Properties for the virtual directory in question
  • choose Virtual directory tab
  • choose Configuration
  • click Insert
  • enter the path to aspnet-isapi.dll (typically c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll).
Ole Lynge
  • 4,457
  • 8
  • 43
  • 57
  • I had the application running as virtual directory, not application. And I also needed to add wildcard mapping for the rewriting of the urls. Thx – Ropstah May 03 '09 at 14:03
0

By the way, the routing seems to be working on application level. No need to bother your domainname or higher directory names.

Ropstah
  • 17,538
  • 24
  • 120
  • 194