【发布时间】:2013-02-04 10:13:27
【问题描述】:
我在 ASP.NET 页面中使用ScriptManager:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
从那时起,每次我重建页面(加载程序集)时都会发生错误:
[FormatException: String was not recognized as a valid DateTime.]
System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +3624418
System.Windows.Forms.TypeLibraryTimeStampAttribute..ctor(String timestamp) +49
System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0
System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +46
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +529
System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33
System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +76
System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() +399
System.Web.UI.ScriptManager..ctor() +26
ASP.usercontrols_asyncprocessingmonitor_ascx.__BuildControlScriptManager1() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\UserControls\AsyncProcessingMonitor.ascx:5
ASP.usercontrols_asyncprocessingmonitor_ascx.__BuildControlTree(usercontrols_asyncprocessingmonitor_ascx __ctrl) in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\UserControls\AsyncProcessingMonitor.ascx:1
ASP.usercontrols_asyncprocessingmonitor_ascx.FrameworkInitialize() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\UserControls\AsyncProcessingMonitor.ascx.cs:912307
System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
System.Web.UI.UserControl.InitializeAsUserControl(Page page) +14
ASP.provisioning_default_aspx.__BuildControlasyncProcessingMonitor1() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\Provisioning\default.aspx:124
ASP.provisioning_default_aspx.__BuildControlpnlProcessMonitor() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\Provisioning\default.aspx:123
ASP.provisioning_default_aspx.__BuildControlForm1() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\Provisioning\default.aspx:51
ASP.provisioning_default_aspx.__BuildControlTree(provisioning_default_aspx __ctrl) in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\Provisioning\default.aspx:1
ASP.provisioning_default_aspx.FrameworkInitialize() in d:\Developpement\Projects\CyberClasse\LNMManager\ManagementConsole\Provisioning\default.aspx.cs:912308
System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +54
System.Web.UI.Page.ProcessRequest() +78
System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.provisioning_default_aspx.ProcessRequest(HttpContext context) in c:\Users\nba\AppData\Local\Temp\Temporary ASP.NET Files\managementconsole\6fc95b25\3fc34eab\App_Web_pm33amsb.2.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
刷新页面后,错误就会消失。
我不明白这个错误。在许多论坛中,都将 System.Windows.Forms 程序集作为此错误的来源。这个程序集在我的网站项目中被引用,但我删除了它,错误仍然出现。
编辑
例如,here 和 here 报告了此问题(但与自定义脚本管理器有关)。
编辑 2
嗯。这是用户控件的一些代码,插入到asp.net页面中。
<asp:UpdatePanel ID="UpdatePanel1" runat="server" style="width:70%;" >
<ContentTemplate>
<asp:HiddenField ID="HiddenFieldProcessID" runat="server" />
<asp:HiddenField ID="HiddenFieldRedirectURL" runat="server" Value="" />
<asp:HiddenField ID="HiddenFieldRedirect" runat="server" Value="false" />
<asp:Timer ID="TimerStatusUpdate" runat="server" Interval="1000" OnTick="TimerStatusUpdateTick"></asp:Timer>
<br/><br/>
<div align="center"><asp:Image ID="ImageProgressGif" runat="server" ImageUrl="https://cms.unov.org/FullTextSearch/Common/Images/progress.gif" /></div>
<br/>
<table>
<tr>
<td style="width: 30%;">Label Text :
</td>
<td>
<b>
<asp:Label ID="LabelCurrent" runat="server"></asp:Label> / <asp:Label ID="LabelTotal" runat="server"></asp:Label>
</b>
<input id="inputpercentage" name="inputpercentage" type="text" runat="server" hidden="true"/>
<input type="hidden" runat='server' id="completed" value="" />
<br/>
</td>
</tr>
</table>
<table>
<tr>
<td>
<asp:label id="LabelExportInfo" runat="server" Width="100%" Visible="true" Font-Size="Small" ForeColor="#6666FF"></asp:label>
<asp:linkbutton id="LinkExportInfo" runat="server" Width="100%" Visible="true" OnClick="DownloadFile" Font-Size="Small"></asp:linkbutton>
</td>
</tr>
<tr>
<td>
<asp:Label ID="LabelPasswordChanged" runat="server" Font-Size="Small" ForeColor="Red"></asp:Label>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
但是,正如我所说,堆栈跟踪和提供的主题显示的报告问题来自程序集(它的“TypeLibraryTimeStampAttribute”属性更具体)。但是,我的观点是,我怎么知道它是关于哪个程序集的?
此外,我已按照主题中的建议删除了项目中对 System.Windows.Form 的引用,但没有结果。
编辑 3
一位同事在他的计算机上打开了该项目,构建并运行它,没有任何错误。他的一切都很好。所以,明确地说,这个问题在代码外部。 我就像他岛上的约翰洛克:迷路了。
有什么线索吗?
【问题讨论】:
-
String was not recognized as a valid DateTime.错误很明显,与 ScriptManager 无关。 -
这个错误是一般的 c# 错误,只是因为你的页面被包裹在 scriptManager 中(实际上使用 xmlHTTPhandler)它在页面的特定块中显示为错误,登录到控制台,因为它是部分页面渲染。
-
@walther 感谢您的评论。我知道那是什么意思,完全不适合我的情况。你没有帮助。
-
@VishalSachdeva 我的代码不包含任何日期解析(嗯,事实上,根本没有解析器,甚至在 javascript 中也不包含)。此外,您如何解释使错误消失的重新加载?
-
我更新了我的问题。我提供了类似问题的主题。
标签: asp.net ajax scriptmanager