2009-07-27 15 views
7

この特定の例外の意味と解決方法を知っていますか?最初のチャンスSystem.Configuration.ConfigurationErrorsException "この要素は現在どのコンテキストにも関連付けられていません"

[例外]ダイアログボックスでは、抑制についてのヘルプは表示されません。可能であれば、原因の根本的な原因とその原因を解決する方法を理解したいと思います。

ありがとうございました。

P.S.

FCEの原因となる行は次のようになります。

using (ServiceHost host = new ServiceHost(typeof(WcfPortal))) 

例外の詳細:

System.Configuration.ConfigurationErrorsException occurred 
    Message="This element is not currently associated with any context" 
    Source="System.Configuration" 
    BareMessage="This element is not currently associated with any context" 
    Line=0 
    StackTrace: 
     at System.Configuration.ConfigurationElement.get_EvaluationContext() 
    InnerException: 

コールスタックは、次のとおりです。

System.Configuration.dll!System.Configuration.ConfigurationElement.EvaluationContext.get() + 0x64 bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ServiceModelExtensionElement.System.ServiceModel.Configuration.IConfigurationContextProviderInternal.GetEvaluationContext() + 0x1f bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ConfigurationHelpers.GetEvaluationContext(System.ServiceModel.Configuration.IConfigurationContextProviderInternal provider = {System.ServiceModel.Configuration.ServiceDebugElement}) + 0x41 bytes  
System.ServiceModel.dll!System.ServiceModel.Configuration.ServiceModelExtensionElement.GetConfigurationElementName() + 0x72 bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ServiceModelExtensionElement.ConfigurationElementName.get() + 0x3a bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ServiceModelExtensionCollectionElement<System.ServiceModel.Configuration.BehaviorExtensionElement>.Add(System.ServiceModel.Configuration.BehaviorExtensionElement element = {System.ServiceModel.Configuration.ServiceDebugElement}) + 0x2a6 bytes  
System.ServiceModel.dll!System.ServiceModel.Configuration.ServiceBehaviorElement.Add(System.ServiceModel.Configuration.BehaviorExtensionElement element = {System.ServiceModel.Configuration.ServiceDebugElement}) + 0x16b bytes  
System.ServiceModel.dll!System.ServiceModel.Configuration.ServiceModelExtensionCollectionElement<System.ServiceModel.Configuration.BehaviorExtensionElement>.DeserializeElementCore(System.Xml.XmlReader reader = {Element, Name="serviceDebug"}) + 0x1eb bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ServiceModelExtensionCollectionElement<System.ServiceModel.Configuration.BehaviorExtensionElement>.DeserializeElement(System.Xml.XmlReader reader = {Element, Name="serviceDebug"}, bool serializeCollectionKey = false) + 0x2f bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ServiceBehaviorElement.DeserializeElement(System.Xml.XmlReader reader = {Element, Name="serviceDebug"}, bool serializeCollectionKey = false) + 0x2b bytes 
System.Configuration.dll!System.Configuration.ConfigurationElementCollection.OnDeserializeUnrecognizedElement(string elementName = "behavior", System.Xml.XmlReader reader = {Element, Name="serviceDebug"}) + 0xc0 bytes 
System.Configuration.dll!System.Configuration.ConfigurationElement.DeserializeElement(System.Xml.XmlReader reader = {Element, Name="serviceDebug"}, bool serializeCollectionKey = false) + 0xf48 bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ServiceBehaviorElementCollection.DeserializeElement(System.Xml.XmlReader reader = {Element, Name="serviceDebug"}, bool serializeCollectionKey = false) + 0x2a bytes 
System.Configuration.dll!System.Configuration.ConfigurationElement.DeserializeElement(System.Xml.XmlReader reader = {Element, Name="serviceDebug"}, bool serializeCollectionKey = false) + 0xe6c bytes 
System.Configuration.dll!System.Configuration.ConfigurationSection.DeserializeSection(System.Xml.XmlReader reader = {Element, Name="serviceDebug"}) + 0x8a bytes  
System.Configuration.dll!System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(System.Configuration.RuntimeConfigurationRecord configRecord = ConfigPath = "MACHINE/EXE", System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/behaviors", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/behaviors", object parentConfig = {System.ServiceModel.Configuration.BehaviorsSection}, System.Configuration.ConfigXmlReader reader = {Element, Name="serviceDebug"}) + 0xf6 bytes  
System.Configuration.dll!System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(System.Configuration.RuntimeConfigurationRecord configRecord = ConfigPath = "MACHINE/EXE", System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/behaviors", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/behaviors", object parentConfig = {System.ServiceModel.Configuration.BehaviorsSection}, System.Configuration.ConfigXmlReader reader = {Element, Name="serviceDebug"}) + 0x98 bytes 
System.Configuration.dll!System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSection(bool inputIsTrusted = false, System.Configuration.RuntimeConfigurationRecord configRecord = ConfigPath = "MACHINE/EXE", System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/behaviors", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/behaviors", object parentConfig = {System.ServiceModel.Configuration.BehaviorsSection}, System.Configuration.ConfigXmlReader reader = {Element, Name="serviceDebug"}) + 0x5e bytes 
System.Configuration.dll!System.Configuration.RuntimeConfigurationRecord.CreateSection(bool inputIsTrusted = false, System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/behaviors", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/behaviors", object parentConfig = {System.ServiceModel.Configuration.BehaviorsSection}, System.Configuration.ConfigXmlReader reader = {Element, Name="serviceDebug"}) + 0x7a bytes 
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.CallCreateSection(bool inputIsTrusted = false, System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/behaviors", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/behaviors", object parentConfig = {System.ServiceModel.Configuration.BehaviorsSection}, System.Configuration.ConfigXmlReader reader = {Element, Name="serviceDebug"}, string filename = "C:\\Dev\\windows\\bin\\Debug\\Server.Host.exe.Config", int line = 89) + 0x74 bytes  
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.EvaluateOne(string[] keys = {string[2]}, System.Configuration.SectionInput input = SectionInput "system.serviceModel/behaviors", bool isTrusted = false, System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/behaviors", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/behaviors", object parentResult = {System.ServiceModel.Configuration.BehaviorsSection}) + 0x115 bytes  
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.Evaluate(System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/behaviors", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/behaviors", object parentResult = {System.ServiceModel.Configuration.BehaviorsSection}, bool getLkg = false, bool getRuntimeObject = true, out object result = null, out object resultRuntimeObject = null) + 0x626 bytes  
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.GetSectionRecursive(string configKey = "system.serviceModel/behaviors", bool getLkg = false, bool checkPermission = true, bool getRuntimeObject = true, bool requestIsHere = true, out object result = null, out object resultRuntimeObject = null) + 0x670 bytes 
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.GetSection(string configKey = "system.serviceModel/behaviors", bool getLkg = false, bool checkPermission = true) + 0x44 bytes 
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.GetSection(string configKey = "system.serviceModel/behaviors") + 0x2a bytes 
System.Configuration.dll!System.Configuration.ContextInformation.GetSection(string sectionName = "system.serviceModel/behaviors") + 0x2a bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetSectionFromContext(System.Configuration.ContextInformation evalContext = {System.Configuration.ContextInformation}, string sectionPath = "system.serviceModel/behaviors") + 0x3a bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetAssociatedSection(System.Configuration.ContextInformation evalContext = {System.Configuration.ContextInformation}, string sectionPath = "system.serviceModel/behaviors") + 0x3b bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.BehaviorsSection.ValidateServiceBehaviorReference(string behaviorConfiguration = "serviceBehavior", System.Configuration.ContextInformation evaluationContext = {System.Configuration.ContextInformation}, System.Configuration.ConfigurationElement configurationElement = {System.ServiceModel.Configuration.ServiceElement}) + 0x66 bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ServicesSection.ValidateSection() + 0xe7 bytes  
System.ServiceModel.dll!System.ServiceModel.Configuration.ServicesSection.PostDeserialize() + 0x1e bytes  
System.Configuration.dll!System.Configuration.ConfigurationElement.DeserializeElement(System.Xml.XmlReader reader = {EndElement, Name="services"}, bool serializeCollectionKey = false) + 0x1fef bytes 
System.Configuration.dll!System.Configuration.ConfigurationSection.DeserializeSection(System.Xml.XmlReader reader = {EndElement, Name="services"}) + 0x8a bytes 
System.Configuration.dll!System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionImpl(System.Configuration.RuntimeConfigurationRecord configRecord = ConfigPath = "MACHINE/EXE", System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/services", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/services", object parentConfig = {System.ServiceModel.Configuration.ServicesSection}, System.Configuration.ConfigXmlReader reader = {EndElement, Name="services"}) + 0xf6 bytes  
System.Configuration.dll!System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSectionWithRestrictedPermissions(System.Configuration.RuntimeConfigurationRecord configRecord = ConfigPath = "MACHINE/EXE", System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/services", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/services", object parentConfig = {System.ServiceModel.Configuration.ServicesSection}, System.Configuration.ConfigXmlReader reader = {EndElement, Name="services"}) + 0x98 bytes 
System.Configuration.dll!System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.CreateSection(bool inputIsTrusted = false, System.Configuration.RuntimeConfigurationRecord configRecord = ConfigPath = "MACHINE/EXE", System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/services", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/services", object parentConfig = {System.ServiceModel.Configuration.ServicesSection}, System.Configuration.ConfigXmlReader reader = {EndElement, Name="services"}) + 0x5e bytes 
System.Configuration.dll!System.Configuration.RuntimeConfigurationRecord.CreateSection(bool inputIsTrusted = false, System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/services", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/services", object parentConfig = {System.ServiceModel.Configuration.ServicesSection}, System.Configuration.ConfigXmlReader reader = {EndElement, Name="services"}) + 0x7a bytes 
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.CallCreateSection(bool inputIsTrusted = false, System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/services", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/services", object parentConfig = {System.ServiceModel.Configuration.ServicesSection}, System.Configuration.ConfigXmlReader reader = {EndElement, Name="services"}, string filename = "C:\\Dev\\windows\\bin\\Debug\\Server.Host.exe.Config", int line = 78) + 0x74 bytes  
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.EvaluateOne(string[] keys = {string[2]}, System.Configuration.SectionInput input = SectionInput "system.serviceModel/services", bool isTrusted = false, System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/services", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/services", object parentResult = {System.ServiceModel.Configuration.ServicesSection}) + 0x115 bytes  
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.Evaluate(System.Configuration.FactoryRecord factoryRecord = FactoryRecord "system.serviceModel/services", System.Configuration.SectionRecord sectionRecord = SectionRecord "system.serviceModel/services", object parentResult = {System.ServiceModel.Configuration.ServicesSection}, bool getLkg = false, bool getRuntimeObject = true, out object result = null, out object resultRuntimeObject = null) + 0x626 bytes 
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.GetSectionRecursive(string configKey = "system.serviceModel/services", bool getLkg = false, bool checkPermission = false, bool getRuntimeObject = true, bool requestIsHere = false, out object result = null, out object resultRuntimeObject = null) + 0x670 bytes  
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.GetSectionRecursive(string configKey = "system.serviceModel/services", bool getLkg = false, bool checkPermission = false, bool getRuntimeObject = true, bool requestIsHere = false, out object result = null, out object resultRuntimeObject = null) + 0x63d bytes  
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.GetSectionRecursive(string configKey = "system.serviceModel/services", bool getLkg = false, bool checkPermission = true, bool getRuntimeObject = true, bool requestIsHere = true, out object result = null, out object resultRuntimeObject = null) + 0x63d bytes 
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.GetSection(string configKey = "system.serviceModel/services", bool getLkg = false, bool checkPermission = true) + 0x44 bytes 
System.Configuration.dll!System.Configuration.BaseConfigurationRecord.GetSection(string configKey = "system.serviceModel/services") + 0x2a bytes  
System.Configuration.dll!System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(string sectionName = "system.serviceModel/services") + 0x7e bytes  
System.Configuration.dll!System.Configuration.ConfigurationManager.GetSection(string sectionName = "system.serviceModel/services") + 0x48 bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetSectionFromConfigurationManager(string sectionPath = "system.serviceModel/services") + 0x31 bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetAssociatedSection(System.Configuration.ContextInformation evalContext = null, string sectionPath = "system.serviceModel/services") + 0xac bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ConfigurationHelpers.UnsafeGetSection(string sectionPath = "system.serviceModel/services") + 0x22 bytes 
System.ServiceModel.dll!System.ServiceModel.Configuration.ServicesSection.UnsafeGetSection() + 0x26 bytes 
System.ServiceModel.dll!System.ServiceModel.Description.ConfigLoader.LookupService(string serviceConfigurationName = "Csla.Server.Hosts.WcfPortal") + 0x39 bytes  
System.ServiceModel.dll!System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(System.ServiceModel.Description.ConfigLoader configLoader = {System.ServiceModel.Description.ConfigLoader}, System.ServiceModel.Description.ServiceDescription description = ServiceType={Csla.Server.Hosts.WcfPortal}, string configurationName = "Csla.Server.Hosts.WcfPortal") + 0x2d bytes 
System.ServiceModel.dll!System.ServiceModel.ServiceHostBase.ApplyConfiguration() + 0xfa bytes 
System.ServiceModel.dll!System.ServiceModel.ServiceHostBase.InitializeDescription(System.ServiceModel.UriSchemeKeyedCollection baseAddresses = {System.ServiceModel.UriSchemeKeyedCollection}) + 0xf8 bytes 
System.ServiceModel.dll!System.ServiceModel.ServiceHost.InitializeDescription(System.Type serviceType = {Name = "WcfPortal" FullName = "Csla.Server.Hosts.WcfPortal"}, System.ServiceModel.UriSchemeKeyedCollection baseAddresses = {System.ServiceModel.UriSchemeKeyedCollection}) + 0x83 bytes  
System.ServiceModel.dll!System.ServiceModel.ServiceHost.ServiceHost(System.Type serviceType = {Name = "WcfPortal" FullName = "Csla.Server.Hosts.WcfPortal"}, System.Uri[] baseAddresses = {System.Uri[0]}) + 0x16a bytes  
Server.Host.exe!Server.Host.Program.Main(string[] args = {string[0]}) Line 37 + 0x38 bytes C# 

EDIT

.NET 4およびVS2010にアップグレードした後に問題が発生しません。私はMSがそれを修正したと思います。

+0

詳細を提供してください。あなたはデバッガでこれを見ていますか?また、完全な例外を投稿してください。 –

答えて

5

私は過去にWCFを扱うときに同様の問題を抱えていました。この場合、基本的に例外を飲み込んだMSコードでしたが、デバッグモードではFCEとして捕捉されました。詳細については、this linkを参照してください。

問題がWCFにある場合は、FCEダイアログを表示しないようにすることが適切です。 WCFに関連していない場合は、使用している別の基本クラスライブラリまたはサードパーティのDLLにある可能性があります。いずれにしても、それほど多くはできません。私の経験では、この例外が何か意味のあるものになることはありませんでした。

もしそれが何らかの価値があると思われる場合は、例外が発生した場所に関するコンテキスト情報を少し投稿して、人々がチャイムインして支援を受けることができます。

0

まったく同じ問題が発生してから1時間ほどかかりました。

Webサービスを呼び出してデータを取得しているWPFアプリケーションがあります。

今朝、私はVS2008の例外ダイアログに行き、 "Common Language Runtime Exceptions"の例外をスローするように求めました。

その時から、私のアプリは、すぐにそれが私のWebサービス変数初期化するためにラインを打つようクラッシュしていました:

MikesWebServiceSoapClientクライアント=新しいMikesWebServiceSoapClientを();タイプの

最初のチャンス例外「System.Configuration.ConfigurationErrorsExceptionは」System.Configuration.dll で発生しました追加情報:この要素は現在、任意のコンテキスト

に関連付けられていない私はコメントを読みましたこのStackOverflowスレッドが、混乱しました。例外ダイアログでは、 "System.Configuration"例外がスローされるのを無効にできますが、この例外は引き続き発生します。そして私は、System.Configurationに関する他の例外はありませんでした。

私は「Common Language Runtime Exceptions」にチェックを入れてみましたが、すべての子どもには子供をいじらないようにしました。しかし、まだ例外でクラッシュしていました私のアプリ...結局

は、私はOKをクリックし、[例外]ダイアログボックスで、私は「System.Configuration.ConfigurationErrorsException」と呼ばれる新しい例外の種類を追加に必要なことに気づきましたこの新しい例外タイプをUNTICKします。

今、私のアプリケーションは実行されますが、例外は黙って発生しますが、アプリケーションは動作し続けます。

私はWPFが好きですが、何年もの間、このような愚かな問題を追い払うのにどれくらいの時間を費やしているのでしょうか。

私は気にしませんでしたが、これはVS2008によって作成されたWebService変数でした...それはいつもうまく機能しています。あなたは例外に注意を払うようにWPFを頼むまでは、それは

-1

データデベロッパーセンターhttp://social.msdn.microsoft.com/Forums/en-US/adodotnetdataservices/thread/e2d07245-b305-4d12-82e5-6074175271d6>データプラットフォーム開発フォーラム> WCF データサービス(旧称ADO.NETデータサービスとして知られている)> ...ですまず チャンスSystem.Configuration.ConfigurationErrorsException

SilverlightのWebサービス「この要素 は現在、任意のコンテキストに関連付けられていません」。

多くの実験の後、私はこのバグを解決するために何ができるのかを見つけました。あなたはデバッグからリリースまですべてを変更します。これは、web.configファイル内の(from = "true")などのすべての属性を変更し、Visual StudioのConfiguration ManagerをDebugからReleaseに設定することを意味します。

これを行うと、バグが消えます。オリジナルの回避策は間違っています。データセットからクラスに変更する必要はありません。リリースを変更すると、バグが消えます。私の場合は

1

は、次の解決策は、働いていた:私は(例外の詳細で)、私のプログラムを使用した構成(設定)ファイルを見つけ

  1. デバッグを停止しました。
  2. 場所から設定ファイルを削除しました。
  3. 私は私のアプリをrecompliled
  4. ...

希望はあまりにもあなたのケースで動作します:)

関連する問題