Question

I have an MVC 3 site that runs across three load-balanced servers. On one of the servers this link:

 @Html.ActionLink("Admin", "Index", new { area = "Admin", controller = "Home" })

gets rendered correctly.

http://my1.mvcsite.com/Admin/Home

On the other two the URL comes out wrong.

http://my2.mvcsite.com/?area=Admin

None of the servers have MVC 3 installed on them so when I push changes I include the deployable assemblies. I know it's not problems with the routes because in other places I'm using fairly complex routes and these work fine on all three servers. Also manually typing routes into the browser works OK but not for the Areas on the two rogue servers.

The issue seems to be that two of the servers don't know anything about Areas, which seems very odd. Has anyone else encountered a problem like this and if so what did they do to remedy this?

Edit

All three servers are Windows Server 2008 R2 DataCentre and run IIS7

Was it helpful?

Solution

Me and a colleague have fixed this problem by removing this file from the Temporary ASP.NET Files from the two rogue servers.

MVC-AreaRegistrationTypeCache.xml

which was found here:

 C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\06304885\908d56a6\UserCache

On the servers where the Areas were not mapped nor found the XML was as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!--This file is automatically generated. Please do not modify the contents of this file.-->
<typeCache mvcVersionId="3cff62e5-ef21-4e58-897f-d0f1eafd3beb" lastModified="10/09/2013 15:10:21"/>

Deleting this file, and re-starting the App Pool, causes it to be re-created and then the Areas work.

The file is now:

<?xml version="1.0" encoding="utf-8"?>
<!--This file is automatically generated. Please do not modify the contents of this file.-->
<typeCache lastModified="04/10/2013 15:45:02" mvcVersionId="3cff62e5-ef21-4e58-897f-d0f1eafd3beb">
  <assembly name="MyMVCSite, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
    <module versionId="a3ce0d47-e370-4176-a07b-76aec3a3c25c">
  <type>MyMVCSite.Areas.Admin.AdminAreaRegistration</type>
</module>

This feels somewhat wrong in that I'm not certain as to why this occurred; but after two days of banging my head against a brick-wall it'll do.

This article seems to suggest that what I've found is a bug with MVC. I don't know if the issue is with MVC 3 only.

EDIT

Just found this link that suggests there might be a problem with MVC 4

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top