2

this is driving me to insanity no thanks to Recaptcha! Does anyone know where I can get a copy of the MVC dll version 2.0.0.0 to get this crappy Recaptcha working? I have tried all the previous versions of mvc and Recaptcha but nothing works! It works on my local machine with 1.0 but if I put it to a live server, it has non of it. Does anyone have any suggestions?

I should point out that my site is a web forms site,

Thanks

Here's the stupid error:

Error occured

System.Exception: Unable to load one or more of the types in assembly 'Recaptcha, Version=1.0.4.0, Culture=neutral, PublicKeyToken=null'. Exceptions were thrown:
System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=2.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)
  at umbraco.BusinessLogic.Utils.TypeFinder.FindClassesMarkedWithAttribute(Assembly assembly, Type attribute)
  at umbraco.BusinessLogic.Utils.TypeFinder.FindClassesMarkedWithAttribute(Type attribute)
  at umbraco.macro.GetXsltExtensionsImpl()
  at umbraco.macro.b__6()
  at umbraco.cms.businesslogic.cache.Cache.GetCacheItem[TT](String cacheKey, Object syncLock, CacheItemPriority priority, CacheItemRemovedCallback refreshAction, CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate`1 getCacheItem)
  at umbraco.macro.GetXsltExtensions()
  at umbraco.macro.AddMacroXsltExtensions()
  at umbraco.presentation.webservices.codeEditorSave.SaveXslt(String fileName, String oldName, String fileContents, Boolean ignoreDebugging)
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
Funky
  • 12,890
  • 35
  • 106
  • 161
  • I'm having exactly the same problem, but even more curiously — I have two near-identical sites (one forked from the other), running _on the same machine_. Both run [Umbraco 4.7.1 with Razor Macros](http://www.aaron-powell.com/umbraco-4-and-razor) and [Recaptcha 1.0.5.0 from NuGet](http://nuget.org/packages/recaptcha). One site happily runs, the other fails with a similar stacktrace (we're not using XSLT, so it differs slightly. Because the site _isn't using System.Web.MVC_, I can't follow the steps in [SO #267006](http://stackoverflow.com/a/267021/205245). Any ideas anyone? – Owen Blacker Oct 11 '12 at 17:55
  • I've added the relevant lines from `umbDebugShowTrace` into a Pastebin: http://pastebin.com/MTJKD3pQ – Owen Blacker Oct 11 '12 at 18:19
  • why don't you use ReCaptcha helper from http://nuget.org/packages/Microsoft.AspNet.Web.Helpers.Mvc ? – frennky Oct 11 '12 at 18:24

1 Answers1

5

Please see this issue on the Umbraco bug tracker. The hand-rolled DI container in Umbraco, called TypeFinder, used for loading XSLT and /base extensions dynamically at runtime is buggy, and ReCaptcha contains a class that inherits from MvcHelper in System.Web.Mvc. As a result, when the DI container tries to load this class, it errors and kills your macros.

This will either be fixed in Umbraco 4.10 as detailed here (Shannon Deminick's TypeFinder from the now-defunct Umbraco v5 is being backported), or you can manually apply a patch from this fork here to the Umbraco source (but do so at your own risk).

Jamie Howarth
  • 3,273
  • 3
  • 20
  • 26
  • I seem to have the same version of `businesslogic.dll` on both projects, but I'll take a look at the other project you emailed me about and see if that version of the DLL makes a difference... – Owen Blacker Oct 12 '12 at 10:19
  • I can't see how to get a DLL from that link, I'm afraid. My developer has just referenced `System.Web.MVC.dll` into the project and that seems to have done the trick for now… – Owen Blacker Oct 12 '12 at 12:17
  • Nope that doesn't seem to make any difference on our Staging server — it fixes it locally, but I still get a System.IO.FileNotFoundException on `'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'` once I've deployed to Staging. – Owen Blacker Oct 15 '12 at 16:34
  • Clear out ASP.NET temp files and recycle the app pool. – Jamie Howarth Oct 15 '12 at 21:47
  • 1
    It might be searching for the DLL in the GAC. It works locally on your developer machine cause MVC is installed in the GAC but not on the server. Set the MVC DLL to copy local or install MVC on your server. – IvanL Oct 17 '12 at 11:34
  • @IvanL No, it's not looking in the GAC — apparently I don't have MVC in my GAC (which surprised me). The answer from Ben (@codegecko) seems to be the right one, it just isn't fixing my project for some reason. Incorporating System.Web.Mvc.dll directly into my project has made _this_ problem go away, at least. – Owen Blacker Oct 18 '12 at 10:48
  • @OwenBlacker: *Incorporating directly*? What do you mean by that? Copying assembly to bin folder directly? Well if you're doing that that simply means that you didn't set MVC assembly to copy local to true. – Robert Koritnik Oct 18 '12 at 11:28
  • 1
    @RobertKoritnik No, the MVC assembly isn't actually required for the project (Umbraco 4.x can use Razor macros, but it's not actually using MVC). The problem seems to be that a dependency-checker that's a part of Umbraco _thinks_ that MVC is required, because it's referenced (but not used) by another dependency. So yes, we've added System.Web.Mvc.dll as a reference to our project — despite not actually needing it — because the Umbraco type checker _thinks_ it's a prerequisite, when it isn't. – Owen Blacker Oct 18 '12 at 16:53