Trouble deploying to server: Could not load file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0'
Hi,
I have a client who is having difficulty getting their site deployed to their live server. The site is Umbraco 6.1.6. It works locally and on the staging server but on the live server (on a different hosting provider) they get the following error:
Server Error in '/' Application.
Could not load file or assembly 'System.Web.WebPages.Razor,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040) Description: An unhandled exception occurred during the
execution of the current web request. Please review the stack trace
for more information about the error and where it originated in the
code.
Exception Details: System.IO.FileLoadException: Could not load file
or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of
the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to
determine why the assembly 'System.Web.WebPages.Razor,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
could not be loaded.
WRN: Assembly binding logging is turned OFF. To enable assembly bind
failure logging, set the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1. Note: There
is some performance penalty associated with assembly bind failure
logging. To turn this feature off, remove the registry value
[HKLM\Software\Microsoft\Fusion!EnableLog].
Stack Trace:
[FileLoadException: Could not load file or assembly
'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The
located assembly's manifest definition does not match the assembly
reference. (Exception from HRESULT: 0x80131040)]
Microsoft.Web.Helpers.PreApplicationStartCode.Start() +0
[InvalidOperationException: The pre-application start initialization
method Start on type Microsoft.Web.Helpers.PreApplicationStartCode
threw an exception with the following error message: Could not load
file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection'1
methods, Func'1 setHostingEnvironmentCultures) +550
System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1
methods) +132
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String
preStartInitListPath) +90
System.Web.Compilation.BuildManager.ExecutePreAppStart() +135
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager
appManager, IApplicationHost appHost, IConfigMapPathFactory
configMapPathFactory, HostingEnvironmentParameters hostingParameters,
PolicyLevel policyLevel, Exception appDomainCreationException) +516
[HttpException (0x80004005): The pre-application start initialization
method Start on type Microsoft.Web.Helpers.PreApplicationStartCode
threw an exception with the following error message: Could not load
file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040).]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874840
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)
+101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest
wr, HttpContext context) +254
Version Information: Microsoft .NET Framework Version:4.0.30319;
ASP.NET Version:4.0.30319.18055
I've had them check that the server is running ASP.NET4, IIS has full or high trust and their permissions are supposedly correct.
It seems to be something to do with the version of razor that's installed on the server but Googling hasn't yielded any useful results - only people changing which DLLs are included in their projects (it's just a standard Umbraco installation so I don't want to have to try re-compiling with different assemblies). Is it possible that they need to install Razor 1 on the server? Would that have any negative implications?
Can anyone suggest what might be wrong and how to get this working?
So you think they're running MVC 3 but they need to be running MVC 4 on their server? If they upgrade from 3 to 4 I need to include this code in the web.config file, right?
I'm just wondering why this isn't just working as it is, as it's a standard Umbraco install and I've never had to do any assembly redirects or anything like this before.
Thanks Stefan. If I need to make some changes that's fine - I'm just wondering why the v6.x sites I've set up until now work fine with no mods, but for some reason this site is erroring when it's loaded onto the clients host server. Apparently their server has both ASP.NET MVC3 and 4.
In the web.config file there is already the following (which is just standard from the default v6.1.6 umbraco install and hasn't been changed at all):
Do I need to change these redirects? This is all well above my head to be honest, so any ideas as to how to get rid of the razor error here would be very much appreciated.
It turns out that they're hosting on a 1and1 shared server, which is a no-go as far as I can tell (probably to do with their custom permissions configuration).
Thanks for your help Stefan but I think this one is beyond rescue and a new host will need to be found.
Incidentally I did manage to bypass the razor error by changing this:
Trouble deploying to server: Could not load file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0'
Hi,
I have a client who is having difficulty getting their site deployed to their live server. The site is Umbraco 6.1.6. It works locally and on the staging server but on the live server (on a different hosting provider) they get the following error:
I've had them check that the server is running ASP.NET4, IIS has full or high trust and their permissions are supposedly correct.
It seems to be something to do with the version of razor that's installed on the server but Googling hasn't yielded any useful results - only people changing which DLLs are included in their projects (it's just a standard Umbraco installation so I don't want to have to try re-compiling with different assemblies). Is it possible that they need to install Razor 1 on the server? Would that have any negative implications?
Can anyone suggest what might be wrong and how to get this working?
Many thanks folks...
Check what version of MVC is running on these different environments. I think some run 3.0 and some run 4.0.
Thanks Stefan. Whilst I find this out, what version should it be? And is it typically possible to change from one to the other?
Well I'd go with MVC 4, because it's newer and better ;-)
When you upgrade to MVC 4, you should add assembly redirect(s):
So you think they're running MVC 3 but they need to be running MVC 4 on their server? If they upgrade from 3 to 4 I need to include this code in the web.config file, right?
I'm just wondering why this isn't just working as it is, as it's a standard Umbraco install and I've never had to do any assembly redirects or anything like this before.
Because things change and sometimes you have to do things manually to get stuff to work, it's not magic ;-)
Thanks Stefan. If I need to make some changes that's fine - I'm just wondering why the v6.x sites I've set up until now work fine with no mods, but for some reason this site is erroring when it's loaded onto the clients host server. Apparently their server has both ASP.NET MVC3 and 4.
In the web.config file there is already the following (which is just standard from the default v6.1.6 umbraco install and hasn't been changed at all):
Do I need to change these redirects? This is all well above my head to be honest, so any ideas as to how to get rid of the razor error here would be very much appreciated.
Many thanks
It turns out that they're hosting on a 1and1 shared server, which is a no-go as far as I can tell (probably to do with their custom permissions configuration).
Thanks for your help Stefan but I think this one is beyond rescue and a new host will need to be found.
Incidentally I did manage to bypass the razor error by changing this:
...to this:
But then some other major issues cropped up - hence abandoning the host.
is working on a reply...