应用程序中的w3wp.exe进程使用哪个配置文件?

问题描述 投票:0回答:1

我遇到了 SerializationException 的问题:内部数组无法扩展到大于 Int32.MaxValue 元素..

解决方案是在配置文件中添加以下行。

<AppContextSwitchOverrides value="Switch.System.Runtime.Serialization.UseNewMaxArraySize=true" />

但问题是,即使将其添加到 web.config 文件中,问题也没有得到解决。 .Net版本是4.8,更改后也重新启动了IIS。

我使用procmon查看w3wp使用的配置文件,它显示配置文件路径为: 对于某些进程:C:\inetpub emp pppools\Archer\Archer.config 对于其他一些进程:C:\inetpub emp pppools\DefaultAppPool\DefaultAppPool.config

请帮助我了解 w3wp.exe 进程使用哪个配置文件,因为它报告了该特定进程。

这是堆栈跟踪:

<InnerException>
    <ExceptionType>System.InvalidOperationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
    <Message>Unable to find html field value for typename 'Field'</Message>
    <Source>CompanyTech.Notifications</Source>
    <StackTrace>  at CompanyTech.Notifications.xslt.NotificationXslExtensions.LookupValue(XPathNodeIterator lookupDefinition, XPathNodeIterator objectIdXPath, String pluginPrefix)</StackTrace>
    <InnerException>
        <ExceptionType>System.Runtime.Serialization.SerializationException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
        <Message>The internal array cannot expand to greater than Int32.MaxValue elements.</Message>
        <Source>mscorlib</Source>
        <StackTrace>  at System.Runtime.Serialization.ObjectIDGenerator.Rehash()

  at System.Runtime.Serialization.ObjectIDGenerator.GetId(Object obj, Boolean&amp; firstTime)

  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.InternalGetId(Object obj, Boolean assignUniqueIdToValueType, Type type, Boolean&amp; isNew)

  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Schedule(Object obj, Boolean assignUniqueIdToValueType, Type type, WriteObjectInfo objectInfo)

  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteMembers(NameInfo memberNameInfo, NameInfo memberTypeNameInfo, Object memberData, WriteObjectInfo objectInfo, NameInfo typeNameInfo, WriteObjectInfo memberObjectInfo)

  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.WriteMemberSetup(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo, String memberName, Type memberType, Object memberData, WriteObjectInfo memberObjectInfo)

  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo, String[] memberNames, Type[] memberTypes, Object[] memberData, WriteObjectInfo[] memberObjectInfos)

  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo)

  at System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck)

  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck)

  at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph)

  at CompanyTech.Notifications.ContentRender.LevelRecordDataContainerDeepCopy(LevelRecordDataContainer levelRecordDataContainer)

  at CompanyTech.Notifications.ContentRender..ctor(IRenderEngine engine, Content content, LevelRecordDataContainer levelRecordDataContainer)

  at CompanyTech.Notifications.Rendering.RenderEngine.GetFieldHtml(Int32 contentId, Int32 fieldId)

  at CompanyTech.Notifications.Providers.Value.ArcherContentNotificationValueProvider.GetHtmlReplacement(String objectId, ValuePlaceholder valuePlaceholder)

  at CompanyTech.Notifications.xslt.NotificationXslExtensions.LookupValue(XPathNodeIterator lookupDefinition, XPathNodeIterator objectIdXPath, String pluginPrefix)</StackTrace>
    </InnerException>
</InnerException>
c# iis serialization web-config
1个回答
0
投票

在 Web.Config 中添加以下行后,问题得到解决。

<appSettings>
    <add key= "AppContext.SetSwitch:Switch.System.Runtime.Serialization.UseNewMaxArraySize" value = "True"/>
</appSettings>
© www.soinside.com 2019 - 2024. All rights reserved.