I'm building a website that's supposed to allow registered members to upload images to media folders, and have run into a problem trying to save these images to Media.
I've distilled the problem down to this code:
public List<ImageVM> SaveImage(IEnumerable<HttpPostedFileBase> files, int memberId)
{
var folder = GetMemberImageFolder(memberId);
foreach(var file in files)
{
var new_image = _mediaService.CreateMedia(file.FileName, folder.Id, Constants.Conventions.MediaTypes.Image, memberId);
new_image.SetValue(_contentTypeBaseService, "umbracoFile", file.FileName, file);
_mediaService.Save(new_image);
}
}
This function works when saving a single image, but if the files collection contain multiple images, it fails with an SQL exception.
Transaction (Process ID 51) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
The Save function looks and somewhat behaves as an async function, but isn't, so how do I work around this issue?
MediaService.Save SQL Deadlock
Hi!
I'm building a website that's supposed to allow registered members to upload images to media folders, and have run into a problem trying to save these images to Media. I've distilled the problem down to this code:
This function works when saving a single image, but if the files collection contain multiple images, it fails with an SQL exception.
The Save function looks and somewhat behaves as an async function, but isn't, so how do I work around this issue?
is working on a reply...