I have installed Umbraco Courier Pro successfully on 2 separate Umbraco installations however I get an Application Error whenever I choose the "Courier" item from a content node's right click menu. The stack trace reads as follows:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at Umbraco.Courier.Core.ItemProvider.get_DatabasePersistence()
at Umbraco.Courier.ItemProviders.DocumentItemProvider.AvailableSystemItems(ItemIdentifier itemId) in c:\Program Files (x86)\teamcity\buildAgent\work\d94035a1177dda67\Umbraco.Courier.Providers\ItemProviders\ContentItemProvider.cs:line 41
at Umbraco.Courier.UI.Dialogs.CommitItem.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I also get the following Application Error when I try to Add something to a revision in the Courier -> Revisions -> Revision Name window:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at Umbraco.Courier.Core.ItemProvider.get_DatabasePersistence()
at Umbraco.Courier.ItemProviders.DataTypeProvider.AvailableSystemItems() in c:\Program Files (x86)\teamcity\buildAgent\work\55470944ec5a8fa2\Umbraco.Courier.Providers\ItemProviders\DataTypeProvider.cs:line 34
at Umbraco.Courier.UI.Dialogs.addItemsToLocalRevision.?(ItemProvider p)
at System.Linq.Enumerable.WhereListIterator`1.MoveNext()
at Umbraco.Courier.UI.Dialogs.addItemsToLocalRevision.Page_Load(Object sender, EventArgs e)
at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
at umbraco.BasePages.BasePage.OnLoad(EventArgs e)
at Umbraco.Courier.UI.Pages.CourierBasePage.OnLoad(EventArgs e)
at Umbraco.Courier.UI.Pages.CourierBaseLicensedPage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
Does anyone know what could be causing these exceptions?
It seems like my problem could be to do with a custom data type I am using which relies on HttpContext. Can anyone confirm whether such a DataType would cause this error in Courier? If so, what are my options - obviously rewriting the custom datatype to not use HttpContext would be one option but is there any other way around this? Could I exclude thes custom data type from Courier to stop this error from happening?
I don't think its because of httpcontext, we've added a fix to sort that problem since those posts were made.
I think its caused by missing dlls, so it cannot load its nhibernate based datalayer. You can turn on debugmode in the /Config/courier.config file (touch web.config after edit)
which will create log files in /app_data/courier/logs, that should give you some idea of what is going on when you try to transfer anything
I have checked and double checked that I am referencing all the correct (supplied) versions of the DLL's for Courier and I am still getting the same errors mentioned in my first post.
Having enabled debuging in the courier.config file, I am getting the following additional debug information in the log_Error.txt file:
03/02/2012 09:26:59: Can't import provider 'Umbraco.Courier.Persistence.V4.NHibernate.NHibernateProvider' id: e0474ca8-e73b-11df-9492-0800200c9a66: System.Web.HttpException (0x80004005): Request is not available in this context
at System.Web.HttpContext.get_Request()
at Umbraco.Licensing.Validator.ValidateLicense(EncryptedLicense license)
at Umbraco.Licensing.Validator.Check()
at Umbraco.Licensing.Validator.IsTrial()
at Umbraco.Courier.Core.Licensing.InfralutionLicensing.IsLight()
at Umbraco.Courier.Core.ProviderCollection`1.(IEnumerable`1 types)
I am struggling to debug this further because the exception is handled within your DLL's and I think it may be getting caught and passed off to the licensing page for display to the user, so it makes it hard to break and dig any deeper into the stack with the VS debugger to find out what's going on.
Taking just one of the errors that I'm experiencing, it looks as though the dropdown menu 'ddProviders' on the dialog page 'addItemsToLocalRevision.aspx' is not being populated because the collection it's trying to databind to is empty (or at least one of the items it's trying to access is not present). I have used DotPeek to take a look at what's going on in the (dll) code behind for this page and there is a fairly complex for each statement in Page_Load() that iterates over a LINQ query.
In terms of how I have Umbraco setup:
I am using SQL Server Express 2008R2 as the DB.
My solution is setup in VS2010 to use a Web Application project rather than a Website project and I am referencing all my DLL's from an external lib folder - I have double checked that all the DLL's are being compiled into the web applications bin directory on build.
I have 3 custom datatypes (all using the usercontrol wrapper)
A custom Media type to handle Excel files
A custom section (umbracoApp).
Besides the Courier package I am only using 2 other packages - 'Improved Media Picker' by Tim Geyssens and 'Standard Values' by Morten Christensen
My next plan of action is to strip out my custom components one by one as I still suspect it's one of these that is causing the problems but if you have any other ideas of things I could try I would much appreciate it.
Hmm, are you using VS dev server to run this on? if so, that could be the cause of this, try switching to IIS express instead (doable from VS, by right-clicking the project - if you have IIS express installed)
No - I'm running this though 'real' IIS on Windows 7, the errors also happen on the production environment which is using IIS on Windows Server 2008 R2.
and you don't have any .lic files in the /bin ? will compile dlls and pdbs for you to use so we can get closer to the root of the issue
Sounds odd tho that licensing would cause this, as we've used the same licensing for the last year with zero reports of this kind, so must be something else
I had completely forgotten that I had started to use TheFarm's Snapshot project (http://farmcode.org/page/Snapshot.aspx) as I'd set out to do all my custom code using TDD and I wanted to use WebFormsMVP to build my user controls. Snapshot involves having a custom Global.asax.cs which sets up a lot of AutoFac IoC stuff and I think it's this that's causing all the problems - certainly when I remove the Global.asax and Global.asax.cs files and recompile, Courier works as expected.
I now need to refactor all my custom code to not use Snapshot - I've not really managed to achieve my TDD goal anyway and I can probably wire up AutoFac myself to do the IoC work that I need.
I'm having the same error when I intantiate a new Node or Document object inside my implementation of global.asax (sample code below). I even tried switching to an httpmodule but courier is complaining the same error. Does anyone know a workaround? Thanks.
Application error - KeyNotFoundException
Hi,
I have installed Umbraco Courier Pro successfully on 2 separate Umbraco installations however I get an Application Error whenever I choose the "Courier" item from a content node's right click menu. The stack trace reads as follows:
I also get the following Application Error when I try to Add something to a revision in the Courier -> Revisions -> Revision Name window:
Does anyone know what could be causing these exceptions?
Jon
Having done a little more research, in particular these forum posts:
http://our.umbraco.org/forum/umbraco-pro/courier/26034-Courier-25-unable-to-deploy-datatypes-that-could-be-deployed-by-Courier-211
http://our.umbraco.org/forum/umbraco-pro/courier/26028-Courier-Error-on-Datatype
It seems like my problem could be to do with a custom data type I am using which relies on HttpContext. Can anyone confirm whether such a DataType would cause this error in Courier? If so, what are my options - obviously rewriting the custom datatype to not use HttpContext would be one option but is there any other way around this? Could I exclude thes custom data type from Courier to stop this error from happening?
Thanks,
Jon
Hi Jon
I don't think its because of httpcontext, we've added a fix to sort that problem since those posts were made.
I think its caused by missing dlls, so it cannot load its nhibernate based datalayer. You can turn on debugmode in the /Config/courier.config file (touch web.config after edit)
which will create log files in /app_data/courier/logs, that should give you some idea of what is going on when you try to transfer anything
Hi Per,
Thanks for your reply.
I have checked and double checked that I am referencing all the correct (supplied) versions of the DLL's for Courier and I am still getting the same errors mentioned in my first post.
Having enabled debuging in the courier.config file, I am getting the following additional debug information in the log_Error.txt file:
My next plan of action is to strip out my custom components one by one as I still suspect it's one of these that is causing the problems but if you have any other ideas of things I could try I would much appreciate it.
Jon
Hmm, are you using VS dev server to run this on? if so, that could be the cause of this, try switching to IIS express instead (doable from VS, by right-clicking the project - if you have IIS express installed)
/per
No - I'm running this though 'real' IIS on Windows 7, the errors also happen on the production environment which is using IIS on Windows Server 2008 R2.
Jon
and you don't have any .lic files in the /bin ? will compile dlls and pdbs for you to use so we can get closer to the root of the issue
Sounds odd tho that licensing would cause this, as we've used the same licensing for the last year with zero reports of this kind, so must be something else
I do have a .lic file in the /bin
I am copying my supplied umbracoCourier.lic file into the /bin directory using a post build event and xcopy.
If you can get me a build that I can break into, I can probably help shed some more light on the issue.
Jon
Hi Per,
I have just realised what the problem is!!
I had completely forgotten that I had started to use TheFarm's Snapshot project (http://farmcode.org/page/Snapshot.aspx) as I'd set out to do all my custom code using TDD and I wanted to use WebFormsMVP to build my user controls. Snapshot involves having a custom Global.asax.cs which sets up a lot of AutoFac IoC stuff and I think it's this that's causing all the problems - certainly when I remove the Global.asax and Global.asax.cs files and recompile, Courier works as expected.
I now need to refactor all my custom code to not use Snapshot - I've not really managed to achieve my TDD goal anyway and I can probably wire up AutoFac myself to do the IoC work that I need.
Thanks for your help anyway!
Jon
Hi,
I'm having the same error when I intantiate a new Node or Document object inside my implementation of global.asax (sample code below). I even tried switching to an httpmodule but courier is complaining the same error. Does anyone know a workaround? Thanks.
public class UmbracoCustomGlobal : umbraco.Global
{
protected override void Application_Start(object sender, EventArgs e)
{
base.Application_Start(sender, e);
Node rootNode = new Node(2222);
}
protected override void Application_End(object sender, EventArgs e)
{
base.Application_End(sender, e);
}
}
is working on a reply...