問:Silverlight的WCF服務參考「給定的鍵不存在在詞典中」
我有一個WCF服務的測試與Silverlight應用程序的參考(.NET 3.5),當我做出一個實例
ServiceReference1.Service1Client client = new Service1Client();
我有以下錯誤:
「給定的鍵不存在在詞典中」
服務是正確的,在web.config中我有這樣的事情
<client>
<endpoint address="http://localhost:49955/Service1.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IService1" contract="ServiceReference1.IService1" name="WSHttpBinding_IService1">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
在非Silverlight應用程序中引用的作品就像一個沙姆沙伊赫....一些想法解決它?
PS:所述服務是默認服務:
[ServiceContract]
public interface IService1
{
[OperationContract]
void DoWork();
}
public class Service1 : IService1
{
public void DoWork()
{
}
}
MORE INFO
{System.Collections.Generic.KeyNotFoundException:給定的鍵不存在在詞典中。 在System.ThrowHelper.ThrowKeyNotFoundException() 在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(字符串endpointConfigurationName,的EndpointAddress remoteAddress) 在System.ServiceModel.EndpointTrait 1.CreateSimplexFactory() at System.ServiceModel.EndpointTrait
1.CreateChannelFactory() 在System.ServiceModel.ClientBase 1.CreateChannelFactoryRef(EndpointTrait
1個endpointTrait) 在System.ServiceModel.ClientBase 1.InitializeChannelFactoryRef() at System.ServiceModel.ClientBase
1..ctor() 在SilverlightApplication2.ServiceReference1.Service1Client..ctor() 在SilverlightApplication2.MainPage.MainPage_Loaded(對象發件人,RoutedEventArgs E) 在MS.Internal。 CoreInvokeHandler.InvokeEventHandler(Int32 typeIndex,Delegate handlerDelegate,Object sender,Object args) 在MS.Internal.JoltHelper.FireEvent(IntPtr的unmanagedObj,IntPtr的unmanagedObjArgs,的Int32 argsTypeIndex,的Int32 actualArgsTypeIndex,字符串eventName的)}
燦你顯示一個完整的堆棧跟蹤?或者更多的.config信息? – 2011-06-01 15:10:31