【问题标题】:OWIN shows yellow screen of deathOWIN 显示黄屏死机
【发布时间】:2019-04-23 07:24:34
【问题描述】:

我们有一个旧的 Web 表单项目,我们想将 OWIN 添加到它。 一个Startup 类被添加到项目中。我们同时拥有 assebmly 属性和配置 owin:appStartup app 密钥。 我们在项目中引用了 Microsoft.Owin.Host.SystemWeb 版本 4.0.0.0。 每当 OWIN 想要发现它的 StartUp 类时,我们都会得到一个带有 FormatException 的黄屏死机(DateTime 字符串的格式不正确) 这是异常的堆栈跟踪:

[FormatException: The string was not recognized as a valid DateTime. There is an unknown word starting at index 20.]
   System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +14272006
   System.Windows.Forms.TypeLibraryTimeStampAttribute..ctor(String timestamp) +53
   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) +48
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +787
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +144
   Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict) +190
   Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList`1 errors) +68
   Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails) +89
   Owin.Loader.DefaultLoader.Load(String startupName, IList`1 errorDetails) +30
   Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +165
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +37
   System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +135
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +160
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +580
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +165
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +267
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +341

[HttpException (0x80004005): The string was not recognized as a valid DateTime. There is an unknown word starting at index 20.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +523
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +107
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +688

我们还有其他运行良好的 Web 表单项目,但我不明白我们的项目出了什么问题。

【问题讨论】:

    标签: c# webforms iis-7 owin-middleware


    【解决方案1】:

    根据您的堆栈跟踪,您的项目中的某处必须有一个 TypeLibraryTimeStampAttribute,其中包含无法用 DateTime 解析的无效输入。

    您的问题可能会通过删除TypeLibraryTimeStampAttribute 或将其输入更改为有效的来解决。

    【讨论】:

    • 我们已经搜索了所有的项目文件,没有找到 TypeLibraryTimeStampAttribute 属性。
    • 必须有一个,你确定在代码中没有使用这个属性吗?您是否在代码中搜索过TypeLibraryTimeStamp
    • 您的项目引用的程序集之一可能具有此属性集(其值对于您当前的语言环境设置无效)。另外,请参阅此相关解决方案:stackoverflow.com/a/14708156/1689226
    猜你喜欢
    • 2010-09-06
    • 2011-01-11
    • 2014-03-12
    • 2011-07-23
    • 2011-06-24
    • 1970-01-01
    • 2011-01-21
    • 2012-10-27
    • 1970-01-01
    相关资源
    最近更新 更多