The given key was not present in the dictionary.

Last post 08-18-2009 6:32 AM by ajay01. 4 replies.

Sort Posts:

  • The given key was not present in the dictionary.

    07-01-2009, 8:27 AM
    • Member
      240 point Member
    • Prateek1
    • Member since 07-01-2009, 11:52 AM
    • Posts 47

     The given key was not present in the dictionary.


    actualll i want to add webservice to my XAML page then that error occur ..

    exception snap shot :


    {System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
      at System.ThrowHelper.ThrowKeyNotFoundException()
      at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
      at System.ServiceModel.Configuration.ServiceModelSectionGroup.get_Client()
      at System.ServiceModel.Description.ConfigLoader.LookupChannel(String configurationName, String contractName, Boolean wildcard)
      at System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
      at System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
      at System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
      at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
      at System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName)
      at System.ServiceModel.EndpointTrait`1.CreateSimplexFactory()
      at System.ServiceModel.EndpointTrait`1.CreateChannelFactory()
      at System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
      at System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
      at System.ServiceModel.ClientBase`1..ctor()
      at PLO.ClientWCF.ClientWCFClient..ctor()
      at PLO.ClientMaster..ctor()
      at PLO.Login.clientImage_MouseLeftButtonDown(Object sender, MouseEventArgs e)
      at System.Windows.CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex, Delegate handlerDelegate, Object sender, Object args)
      at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)}

     what to do...



    thanx in advance 

    Regard

    Prateek Bhatnagar (BCA & MCA)

    Prateek'Tips


    www.msdotnetheaven.com

    Filed under:
  • Re: The given key was not present in the dictionary.

    07-01-2009, 9:40 AM
    • Contributor
      5,138 point Contributor
    • papabear
    • Member since 08-08-2005, 3:49 PM
    • Posts 851

    What is the code that throws this error. It seems pretty straight forward, you are trying to use a key to snag a value and since the key does not exist, it is letting you know...

    Ex object myObj = myCollection[myKey] throws the exception when myKey does not exist within myCollection...

    ;)

    give me suggestions for what to blog... http://www.myfriedmind.com/techblog -> thx

    Mark as "Answered" if this solves that wee old problem...
  • Re: The given key was not present in the dictionary.

    07-01-2009, 6:41 PM

    I also facing the same problem. I have added a WCF service in my code and calling the webservice throgh following code in xaml

    CoreServicesClient svcCore = new CoreServicesClient();
                svcCore.GetDataCompleted += new EventHandler<GetDataCompletedEventArgs>(svcCore_GetDataCompleted);
                svcCore.GetDataAsync(5);



    Getdata() is the default function which comes with Create WCF Service web site template. I just made changes in the name from "Service" to "CoreServices"


    If anyone has a solution then let me know .


    Cheers,
    Akshay,India
  • Re: The given key was not present in the dictionary.

    07-02-2009, 6:25 AM
    Answer

    Check this link


    it will solve your problem

    Regards,Meetu Choudhary
    Microsoft MVP-ASP/ASP.NET

    MsDnM || My Forums || My Blog
  • Re: The given key was not present in the dictionary.

    08-18-2009, 6:32 AM
    • Member
      6 point Member
    • ajay01
    • Member since 12-19-2008, 4:45 AM
    • kathmandu nepal
    • Posts 3

    if you check your app.config file then you will found " <endpoint address="" binding="wsHttpBinding" contract="....."  this line now you can change the binding="basicHttpBinding" instead of binding="wsHttpBinding" ...


    then you take service reference now ServiceReferences.ClientConfig file will contains endpoint.

Page 1 of 1 (5 items)