Why does "as T" get an error but casting with (T) not get an error?
If T is a value type this is an exception, you need to make sure T is either Nullable or a class.
Because 'T' could be a value-type and 'as T' makes no sense for value-types. You can do this:
public T GetMainContentItem<T>(string moduleKey, string itemKey)
where T : class
{
return GetMainContentItem(moduleKey, itemKey) as T;
}