我遇到了 WCF 服务的端点问题。我编写了服务并使用 Windows 窗体项目进行了测试。这工作得很好。当我尝试让它从 Silverlight 工作时,就会出现问题。导致问题的语句是
Dim l_svcOOA As SvcZipStreamClient = New SvcZipStreamClient("BasicHttpBinding_IServiceZipStream")
错误说
在 ServiceModel 客户端配置部分中找不到名称为“BasicHttpBinding_IServiceZipStream”和合同“svcZipStream.ISvcZipStream”的端点元素。这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此名称匹配的端点元素。System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName) 在 System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName) 在 System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address) 在 System.ServiceModel 的堆栈跟踪.ChannelFactory 1.CreateSimplexFactory 1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
at System.ServiceModel.EndpointTrait
() 在 System.ServiceModel.EndpointTrait 1.CreateChannelFactory()
at System.ServiceModel.ClientBase
1。1 endpointTrait)
at System.ServiceModel.ClientBase
1.InitializeChannelFactoryRef() 在 System.ServiceModel.ClientBase`1..ctor(String endpointConfigurationName) 在 Common.svcZipStream.SvcZipStreamClient..ctor(String endpointConfigurationName) 在 Common.clsUtilities.GetFileInZip(String p_ZipFile, String 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>
与往常一样,我们将不胜感激任何帮助。