2009-11-09 52 views
0

我收到以下错误:“给定的关键是不存在的字典。”WCF错误:“给定的关键是不存在的字典。”在初始化客户端代理

的代码只是想创建一个代理客户端连接:

FileService.FileServiceClient svc = new CCS.FileService.FileServiceClient(); 

堆栈跟踪:

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 CCS.FileService.FileServiceClient..ctor() 
    at CCS.MainPage..ctor() 
    at CCS.App.Application_Startup(Object sender, StartupEventArgs 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) 

我有一个Silverlight 3应用程序,我在网站上添加一个WCF服务,以应用。任何人都知道解决这个问题的方法?它看起来很难尝试获取绑定信息。

回答

2

听起来this is an issue with the Visual Studio装错Silverlight 2的文件,而不是Silverlight 3的一个:

To work around this issue for now, uninstall the Silverlight 2 SDK, update your service reference, and rebuild your Silverlight application.

If you want your service to be consumable by both Silverlight 2 and Silverlight 3 applications, you can change the binding back to basicHttpBinding. To do that, edit the web.config file for the web project containing the service. Then update the service reference and rebuild your Silverlight application.

相关问题