Silverlight WCF服务客户端实例化
我在创建WCF服务客户端对象时遇到了一个问题 HelloServiceClient helloWorldClient=新的HelloServiceClient(“BasicHttpBinding_IDataAccess”) 以下是我的ServiceReferences.ClientConfig的内容Silverlight WCF服务客户端实例化,wcf,silverlight,Wcf,Silverlight,我在创建WCF服务客户端对象时遇到了一个问题 HelloServiceClient helloWorldClient=新的HelloServiceClient(“BasicHttpBinding_IDataAccess”) 以下是我的ServiceReferences.ClientConfig的内容 <configuration> <system.serviceModel> <bindings> <basicHttpBinding
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IDataAccess" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8732/Design_Time_Addresses/HelloWcf/Service1/mex" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IDataAccess" contract="IHelloService"
name="BasicHttpBinding_IDataAccess" />
</client>
</system.serviceModel>
</configuration>
错误消息如下所示
System.InvalidOperationException:找不到具有的终结点元素
名称“BasicHttpBinding_IDataAccess”和合同
ServiceModel客户端中的“ServiceReference1.IHelloService”
配置部分。这可能是因为没有配置文件
为应用程序找到,或者因为没有匹配的端点元素
可以在客户端元素中找到此名称。在
System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint
serviceEndpoint,字符串配置名称)位于
System.ServiceModel.ChannelFactory.ApplyConfiguration(字符串
配置名称)位于
System.ServiceModel.ChannelFactory.InitializeEndpoint(字符串
配置名称、端点地址)位于
System.ServiceModel.ChannelFactory1..ctor(字符串
endpointConfigurationName,EndpointAddress(远程地址)位于
System.ServiceModel.EndpointTrait
1.createSimpleFactory()位于
System.ServiceModel.EndpointTrait1.CreateChannelFactory()位于
System.ServiceModel.ClientBase
1.CreateChannelFactoryRef(EndpointTrait1
端点(特征)在
System.ServiceModel.ClientBase
1.InitializeChannelFactoryRef()位于
System.ServiceModel.ClientBase`1..ctor(字符串
endpointConfigurationName)位于
SilverlightApplication1.ServiceReference1.HelloServiceClient..ctor(字符串
endpointConfigurationName)位于
SilverlightApplication1.MainPage。单击按钮(对象发送器,
路线(东)
有人能帮我解决这个问题吗?如果您需要任何其他代码/配置,请务必告诉我。如上所述-如错误中所示,合同名称必须是“ServiceReference1.IHelloService”。与我的文件相关联的合同名称是否需要是“ServiceReference1.IHelloService”。VS将自动为您生成有效的。非常感谢。请在下面标出正确答案-这有助于您的销售代表并使网站正常运行