字符串未被识别为有效的DateTime,asp.net

时间:2011-08-07 13:00:11

标签: c# asp.net datetime scriptmanager

,嗨,

我有一个asp.net和c#网站。

在asp代码中我使用

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>

当我运行我的项目时,我收到此错误:

  

字符串未被识别为有效的DateTime。

我在我的网站上没有使用任何dataTime的东西。

然后,当我刷新页面时,错误消失。

堆栈追踪:

 [FormatException: String was not recognized as a valid DateTime.]
   System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +3610514
   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() +388
   System.Web.UI.ScriptManager..ctor() +26
   ASP.newpipe_aspx.__BuildControlScriptManager1() in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\NewPipe.aspx:17
   ASP.newpipe_aspx.__BuildControlBodyContent(Control __ctrl) in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\NewPipe.aspx:16
   System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12
   System.Web.UI.MasterPage.InstantiateInContentPlaceHolder(Control contentPlaceHolder, ITemplate template) +87
   ASP.site_master.__BuildControlMainContent() in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Site.master:55
   ASP.site_master.__BuildControlfullPage() in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Site.master:16
   ASP.site_master.__BuildControlBody1() in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Site.master:15
   ASP.site_master.__BuildControlTree(site_master __ctrl) in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Site.master:1
   ASP.site_master.FrameworkInitialize() in c:\Documents and Settings\Berzon\Desktop\Kinor\kWebGUI\Site.master.cs:912308
   System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
   System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8893254
   System.Web.UI.Page.get_Master() +54
   System.Web.UI.Page.ApplyMasterPage() +15
   System.Web.UI.Page.PerformPreInit() +45
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +328

可能是什么问题?

2 个答案:

答案 0 :(得分:8)

您引用的文件库[TypeLibraryTimeStampAttribute]传递的日期无效。

找到该库并修复或删除它。

通常,在ASP.Net中使用WinForms库是个坏主意。

答案 1 :(得分:0)

从Web应用程序的bin文件夹中删除所有AxInterop。*。dll文件