Quantcast
Channel: Troubleshooting
Viewing all articles
Browse latest Browse all 1814

Intermittent error reading Web.config in an IIS hosted WCF web service

$
0
0

Hi,

 

We've developed a WCF web service and hosted it in IIS versions 6 and 7 in Windows Server versions 2003 R2 and 2008 R2. After a random moderately long interval of correct running, every new request raises an exception. The exception is always of type System.Configuration.ConfigurationErrorsException, and references a custom section created by us and configured in Web.config; the inner exception can be of two shapes:

-- An error occurred creating the configuration section handler for ...: Object reference not set to an instance of an object.

-- An error occurred creating the configuration section handler for ...: Index was outside the bounds of the array.

Although the message is different, the stack trace is almost the same (same objects, lines, ...)

Example:  

Inner Exception  ---------------  Type : System.NullReferenceException, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089  Message : Object reference not set to an instance of an object.  Source : System.Configuration  Help link :  Data : System.Collections.ListDictionaryInternal  TargetSite : Boolean Contains(System.String)  Stack Trace :    at System.Configuration.ConfigurationPropertyCollection.Contains(String name)     at System.Configuration.ConfigurationPropertyCollection.Add(ConfigurationProperty property)     at ServiceTranslationSettings.ServiceProcessor`1..ctor() in C:\Projects\TFS\CORE v3.0\Provisioning\ServiceTranslationSettings\ServiceProcessor.vb:line 10     at ServiceTranslationSettings.ServiceProcessorCollection`1.CreateNewElement() in C:\Projects\TFS\CORE v3.0\Provisioning\ServiceTranslationSettings\ServiceProcessorCollection.vb:line 29     at System.Configuration.ConfigurationElementCollection.CallCreateNewElement()     at System.Configuration.ConfigurationElementCollection.OnDeserializeUnrecognizedElement(String elementName, XmlReader reader)     at System.Configuration.ConfigurationElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)     at System.Configuration.ConfigurationElement.DeserializeElement(XmlReader reader, Boolean serializeCollectionKey)    at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)     at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)     at System.Configuration.RuntimeConfigurationRecord.CreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader)     at System.Configuration.BaseConfigurationRecord.CallCreateSection(Boolean inputIsTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentConfig, ConfigXmlReader reader, String filename, Int32 line)

Line 10 of that file contains (Visual Basic):

        Me.Properties.Add(New ConfigurationProperty("ServiceName", GetType(String), Nothing))

 

The wrapping exception shows that the error is raised as a result of our service implementing class's asking ConfigurationManager for the custom section configuration.

Example:

Type : System.Configuration.ConfigurationErrorsException, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a

Message : An error occurred creating the configuration section handler for ServiceReader.Settings: Index was outside the bounds of the array.

Source : System.Configuration

Help link :

BareMessage : An error occurred creating the configuration section handler for ServiceReader.Settings: Index was outside the bounds of the array.

Filename : web.config

Line : 332

Errors : System.Configuration.ConfigurationException[]

Data : System.Collections.ListDictionaryInternal

TargetSite : System.Object EvaluateOne(System.String[], System.Configuration.SectionInput, Boolean, System.Configuration.FactoryRecord, System.Configuration.SectionRecord, System.Object)

Stack Trace :    at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)

   at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)

   at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)

   at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)

   at System.Web.Configuration.HttpConfigurationSystem.GetApplicationSection(String sectionName)

   at System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)

   at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)

   at System.Configuration.ConfigurationManager.GetSection(String sectionName)

   at ServiceTranslationSettings.ServiceReaderConfigurationSection.GetConfig()

 

What makes us doubtful that the problem is caused by an error in our code is that this happens after long periods of smooth run with the same web.config and the same operations invoked.

 

We've seen there are more people out there facing similar problems but, apart from a Commerce Server fix (obviously inapplicable to our deployment), there is no known solution.

 

Can you help us?

 

Thank you very much.


Viewing all articles
Browse latest Browse all 1814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>