从Silverlight调用WCF服务时让端点工作
我遇到了WCF服务端点的问题。我编写了这个服务,并用Windows窗体项目进行了测试。这工作得很好。当我尝试从Silverlight中使用它时会出现问题。引起该问题的语句是从Silverlight调用WCF服务时让端点工作
昏暗l_svcOOA作为SvcZipStreamClient =新SvcZipStreamClient(“BasicHttpBinding_IServiceZipStream”)
错误说
找不到名为“BasicHttpBinding_IServiceZipStream”和合同“svcZipStream.ISvcZipStream”终结点元素在ServiceModel客户端配置部分。这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到匹配此名称的端点元素。 堆栈跟踪在System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint,字符串configurationName) 在System.ServiceModel.ChannelFactory.ApplyConfiguration(字符串configurationName) 在System.ServiceModel.ChannelFactory.InitializeEndpoint(字符串configurationName,的EndpointAddress地址) 在System.ServiceModel.ChannelFactory 1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress) at System.ServiceModel.EndpointTrait
1.CreateSimplexFactory() 在System.ServiceModel.EndpointTrait 1.CreateChannelFactory() at System.ServiceModel.ClientBase
1.CreateChannelFactoryRef(EndpointTrait 1 endpointTrait) at System.ServiceModel.ClientBase
1.InitializeChannelFactoryRef() 在System.ServiceModel.ClientBase`1..ctor(字符串endpointConfigurationName) 在普通的.svcZipStream.SvcZipStreamClient..ctor(字符串endpointConfigurationName) 在Common.clsUtilities.GetFileInZip(字符串p_ZipFile,字符串p_FileName)
的ServiceReferences.ClientConfig是:
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_ISvcZipStream" maxBufferSize="2147483647"
maxReceivedMessageSize="2147483647">
<security mode="None" />
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:22214/ServiceZipStream.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_ISvcZipStream"
contract="svcZipStream.ISvcZipStream" name="BasicHttpBinding_ISvcZipStream" />
</client>
</system.serviceModel>
与往常一样,任何帮助将不胜感激。
我只是想让你知道我找到了问题。由于对服务的调用来自Silverlight类库,因此我还需要端点定义的Silverlight应用程序。我在下面的博客中找到了答案。