我正在尝试让最新版本的CropImage.Net在我的网站上工作。
我已经将ImageResizer.dll和Imazen.Crop.dll添加到我的项目中,并且我能够运行ImageResizer的诊断页面,它不报告任何错误,只报告以下警告:
检测到2个问题:(警告):要在此处查看其他错误,请执行图像调整大小请求。(警告):NoCache仅供开发使用,无法扩展到生产使用。添加用于生产的DiskCache或CloudFront
我已经注册了程序集并向页面添加了一个控件:
<%@ Register Assembly="Imazen.Crop" Namespace="Imazen.Crop" TagPrefix="ic" %>
<ic:CropImage ID="CropImage1" runat="server" CanvasHeight="300" ImageID="Image1" CanvasWidth="300" /> <br />一切看起来都很好,但是当我试图访问页面时,我得到了以下错误:
说明:当前web请求执行过程中发生未处理异常。请查看堆栈跟踪,以了解有关错误的更多信息以及错误在代码中的来源。
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Imazen.Crop.CropImage.AddFileReferences() +1917
Imazen.Crop.CropImage.CreateChildControls() +88
System.Web.UI.Control.EnsureChildControls() +188
System.Web.UI.Control.PreRenderRecursiveInternal() +59
System.Web.UI.Control.PreRenderRecursiveInternal() +221
System.Web.UI.Control.PreRenderRecursiveInternal() +221
System.Web.UI.Control.PreRenderRecursiveInternal() +221
System.Web.UI.Control.PreRenderRecursiveInternal() +221
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4296对我哪里出了问题有什么建议或想法吗?
谢谢,
艾尔登
发布于 2013-06-15 11:03:08
这可能有点晚了,但我通过不包含asp:Image成功地重现了您的错误。
如您所见,CropImage控件引用图像的ID:
<ic:CropImage ID="CropImage1" runat="server" CanvasHeight="300" ImageID="Image1" CanvasWidth="300" /> <br />添加具有相同ID的镜像可以解决此问题:
<asp:Image ID="Image1" runat="server" ImageUrl="images/328.jpg" />https://stackoverflow.com/questions/16464460
复制相似问题