Topics: Developer Forum, Project Management Forum, User Forum
Oct 14, 2010 at 11:50 AM


I am using Windows Server 2003 , IIs 6, .net 4 and MVC 2 all are working correctly.

I am using IIRF 2.1 to get the URL routing for MVC 2 correct

I have used the following standard config file

# Iirf.ini

## Commenting the following two statements out, turns off all
## logging in IIRF.
#RewriteLog  c:\inetpub\iirfLogs\Iirf
#RewriteLogLevel 3

IterationLimit 1
RewriteEngine ON
StatusInquiry ON

# Redirect Home.mvc to /.  This will result in a new request being sent
# to IIS + IIRF.  The new request will get rewritten to Home.mvc.
RedirectRule ^/Home.mvc$  /  [I,R=302]

# Rewrite the default pages to /Home.mvc
RewriteRule ^/(default|index)\.(aspx|htm|html)$ /Home.mvc [I,L]
RewriteRule ^/$ /Home.mvc [I,L]

# Any bare URL will get rewritten to a URL with .mvc appended
RewriteRule ^/([\w]+)$ /$1.mvc [I,L]

# Any URL with 2 segments will get rewritten to a URL with .mvc embedded.
RewriteRule ^/(?!Content)([\w]*)/(.*) /$1.mvc/$2 [I,L]

I have added

  "Default.mvc",                                                                // IIS 6 Ionic Isapi Rewrite support
  "{controller}.mvc/{action}/{id}",                                        // URL with parameters
  new { controller = "Home", action = "Index", id = "" },      // Parameter defaults
  new { controller = @"[^\.]*" }                                         // Don't look for a controller for non mvc files (ico, images, etc.)

to the Global.asax

And for the URL https://www.mydomain.co.uk/ everything works fine and the default view from the home controller is displayed.

If I try to link to a new Controller view

i.e. using  Html.ActionLink( "Click me", "Index", "FooName" )%>

the url https://www.mydomain.co.uk/FooName comes back with the error

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /FooName.mvc

I know this works correctly on the development machine in Visual Studio 2010.

I assume this is something I maybe need to add to the IIRF.ini file but I cannot seem to work out what ????

Any help would be appreciated







Oct 14, 2010 at 9:10 PM

Seems there are a bunch of pieces in your scenario.  But the 404 message indicating FooName.mvc was requested, suggests that IIRF correctly post-fixed .mvc to the URL, as you expected. You'd be able to see this very clearly if you examined the IIRF log for that request.

So I suggest that in fact, FooName.mvc, does not exist on the server in question.  There is no resource by that name. Looks like a disconnect between your ASPNET MVC configuration, and the URL you are requesting.

One way to verify this is to factor out IIRF completely.  Rather than requesting /FooName, request /FooName.mvc.  If it does not get you what you expect, then you know it's not IIRF causing the problem.  Likewise you could factor out ASPNET MVC by using a different suffix in the IIRF.ini file, to test/verify that the rules work as advertised.  For example, .txt or something else not handled by ASPNET MVC.

Good luck.


Oct 15, 2010 at 5:58 PM

Thank you for the prompt reply. You are correct it was an issue with me not recompiling the project after the addition to Global.asax





Oct 18, 2010 at 7:29 PM

Glad to hear you solved it!