Quantcast
Channel: C1 CMS Foundation - Open Source on .NET
Viewing all articles
Browse latest Browse all 2540

New Post: System.OutOfMemoryException while DataFacade.AddNew(file, providerName)

$
0
0
i plan to import all news data from another cms, and write some code to do that,but occurs OutOfMemoryException
[OutOfMemoryException: 引发类型为“System.OutOfMemoryException”的异常。]
System.IO.MemoryStream.set_Capacity(Int32 value) +93
System.IO.MemoryStream.EnsureCapacity(Int32 value) +50
System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count) +265
System.IO.Stream.InternalCopyTo(Stream destination, Int32 bufferSize) +41
System.IO.Stream.CopyTo(Stream destination) +130
Composite.Plugins.Data.DataProviders.MediaFileProvider.MediaFileProvider.AddNew(IEnumerable1 datas) +1320
Composite.Data.Foundation.PluginFacades.<>c__DisplayClass10
1.<AddNew>b__e(IWritableDataProvider provider) +52
my code :
        using (FileStream source = new FileStream(localPath, FileMode.Open, FileAccess.Read))
        {
            file.Length = (int)source.Length;
            file.MimeType = MimeTypeInfo.GetCanonicalFromExtension(ext);

            using (Stream destination = file.GetNewWriteStream())
            {
                source.CopyTo(destination);
            }
        }

        return DataFacade.AddNew<IMediaFile>(file, providerName);
when that happend , the IMediaFile is a flv

Viewing all articles
Browse latest Browse all 2540

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>