Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I want to create new media using service that run every 5 hours.
My code is:
var media = Media.MakeNew(name, new MediaType(typeId), new User
But I receive the next error:
at Cultiv.MediaLibraryCache.MediaCache.Cache(String cacheName) at Cultiv.MediaLibraryCache.MediaCache.RemoveFromCache(Int32 id) at Cultiv.MediaLibraryCache.MediaRemoveCacheHandler.RemoveFromCache(Int32 id) at Cultiv.MediaLibraryCache.MediaRemoveCacheHandler.SaveRemoveCacheItem(Media sender, SaveEventArgs e) at umbraco.cms.businesslogic.media.Media.FireAfterSave(SaveEventArgs e) in d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\umbraco\cms\businesslogic\media\Media.cs:line 214 at umbraco.cms.businesslogic.media.Media.Save() in d:\TeamCity\buildAgent\work\7380c184e9fcd3ea\umbraco\cms\businesslogic\media\Media.cs:line 41
How can I avoid it?
I am a bit of a newcomer to this Umbraco stuff - but I suspect that you are trying to using the Save method of the Media object without having a valid database connection underneath. You are using Team City and it may be that it doesn't have sufficient privileges to host the application and connect to the database. Basically - enough rights to save the Media object.
Or alternatively, perhaps you can only call it from a valid HttpContext session. Since Umbraco isn't running unless you have a current session open, this would explain this error message a little.
Media.Save() should only be called directly from within a page. You need to look at another method of inserting Media. I suspect using a valid webservice might do the trick.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted