我正面临一个非常复杂的情况,使用kentico转发器转换,我已经创建了3个自定义转发器来处理以下附件字段"图像,报告和文件",我在页面类型中创建以分离附件类型。所以为了处理我的数据,我跟着this post 创建了以下转换:
<%@ Register Src="~/CMSModules/Content/Controls/Attachments/DocumentAttachments/DocumentAttachments.ascx" TagName="DocumentAttachments" TagPrefix="cms" %><%@ Register Src="~/CMSModules/Content/Controls/Attachments/DocumentAttachments/DocumentAttachmentsVideo.ascx" TagName="DocumentAttachmentsVideo" TagPrefix="cms" %>
< script runat="server">
protected override void OnInit(EventArgs e)
{
CMS.DataEngine.DataClassInfo dci = CMS.DataEngine.DataClassInfoProvider.GetDataClassInfo(Eval("ClassName").ToString(), true);
if (dci != null)
{
CMS.FormEngine.FormInfo fi = new CMS.FormEngine.FormInfo(dci.ClassFormDefinition);
// field name we added in the page type
CMS.FormEngine.FormFieldInfo ffi = fi.GetFormField("Images");
CMS.FormEngine.FormFieldInfo ffiReports = fi.GetFormField("Reports");
CMS.FormEngine.FormFieldInfo ffiFiles = fi.GetFormField("Files");
Guid AttachmentGroupGUID = ffi.Guid;
Guid AttachmentGroupGUIDRep = ffiReports.Guid;
Guid AttachmentGroupGUIDFil = ffiFiles.Guid;
ucDocAttachments.Path = Eval<string>("NodeAliasPath");
ucDocAttachmentReports.Path = Eval<string>("NodeAliasPath");
ucDocAttachmentFil.Path = Eval<string>("NodeAliasPath");
ucDocAttachments.AttachmentGroupGUID = AttachmentGroupGUID;
ucDocAttachmentReports.AttachmentGroupGUID = AttachmentGroupGUIDRep;
ucDocAttachmentFil.AttachmentGroupGUID = AttachmentGroupGUIDFil;
ucDocAttachments.TransformationName = "CMS.Root.Attachment";
ucDocAttachmentReports.TransformationName = "CMS.Root.AttachmentLinks";
ucDocAttachmentFil.TransformationName = "CMS.Root.AttachmentLinks";
ucDocAttachments.StopProcessing = false;
ucDocAttachmentReports.StopProcessing = false;
ucDocAttachmentFil.StopProcessing = false;
ucDocAttachments.ReloadData(true);
ucDocAttachmentReports.ReloadData(true);
ucDocAttachmentFil.ReloadData(true);
}
}
< /script>
<div class="innerSelectedElectionContainer col-xs-12 selected-<%# DataItemIndex %>">
<div class="col-xs-12 selectedElectionInfo selectedContent-0">
<div class="col-xs-12 selectedElectionTitle elem-to-hide">
<%# Eval("Title") %>
</div>
<div class="col-xs-12 selectedElectionText elem-to-hide">
<%# Eval("Text") %>
</div>
</div>
<div class="selectedElectionInfo elem-to-hide selectedContent-1">
<div class="col-xs-12 photosLabel"><%# Localize("{$photosGallery$}") %></div>
<div class="col-xs-12 noPaddingSides FlexWrap"> <cms:DocumentAttachments ID="ucDocAttachments" runat="server" PageSize="100" GetBinary="false" />
</div>
</div>
<div class="selectedElectionInfo elem-to-hide selectedContent-2 col-xs-12">
<div class="col-xs-12 photosLabel"><%# Localize("{$videosGallery$}") %></div><cms:DocumentAttachmentsVideo ID="DocumentAttachmentsVideo" runat="server" GetBinary="false" StopProcessing="true" ImageFieldValues='<%# Eval("Videos") %>' />
</div>
<div class="selectedElectionInfo elem-to-hide selectedContent-3">
<div class="col-xs-12 photosLabel"><%# Localize("{$reports$}") %></div>
<div class="col-xs-12 selectedContent-3 ElectionReports"><cms:DocumentAttachments ID="ucDocAttachmentReports" PageSize="100" runat="server" GetBinary="false" StopProcessing="true" /> </div>
</div>
<div class="selectedElectionInfo elem-to-hide selectedContent-4">
<div class="col-xs-12 photosLabel"><%# Localize("{$files$}") %></div>
<div class="col-xs-12 selectedContent-4 ElectionFiles"><cms:DocumentAttachments ID="ucDocAttachmentFil" PageSize="100" runat="server" GetBinary="false" StopProcessing="true" />
</div>
</div></div>
但问题是系统现在正在返回一个内存不足的异常,这是暂时的,但现在网站根本没有处理,我很难找到原因,因为系统正常工作对于某些数据,在一定的刷新后,它会返回相同数据的异常,因此它是随机的,这里是事件日志的截图:
当回到后面的代码时,我发现异常在这一行上执行:ucRepeater.DataSource = ucDataSource.DataSource;
有人知道什么是错的,我该如何解决这个问题?
答案 0 :(得分:0)
您可以在此处继续在原始帖子中发帖,即使它的答案是:
https://devnet.kentico.com/questions/system-outofmemoryexception
如果二进制文件没有永久修复它,如果你仍有内存问题,如果你的内存不足,我会查看数据库或网络服务器。
同时检查系统&gt;一般情况下,看看缓存中使用了多少内存,如果你正在缓存很多可能导致你的记忆达到它的限制。