关于webService提示An endpoint configuration...的问题
发布时间:2020-12-17 01:08:29 所属栏目:安全 来源:网络整理
导读:在silverlight中使用webService如果你两次以上删除同一个服务同时再添加该服务的情况下,程序在调试阶段会报错。错误提示为: An endpoint configuration section for contract 'ServiceReference1.Service' could not be loaded because more than one endp
在silverlight中使用webService如果你两次以上删除同一个服务同时再添加该服务的情况下,程序在调试阶段会报错。错误提示为: An endpoint configuration section for contract 'ServiceReference1.Service' could not be loaded because more than one endpoint configuration for that contract was found. Please indicate the preferred endpoint configuration section by name. 因为之前没接触过WSDL文件,对于WSDL文件报错还是有点束手无策。我就直接复制这个错误到google中搜索,后来发现搜索结果都是WCF的样式,还是看不懂。一段时间后我再次读这个错误,这个错误说? because more than one endpoint configuration for that contract was found 代表有多个终结点存在,需要显示指定使用哪个。再参考WCF中的解决方案(在此不罗列)于是我找到webService中的配置文件(注意是配置文件.svcinfo为后缀,而不是WSDL文件)webService在vs中显示的样式如下图 ??????? 查看该配置文件如下 <?xml version="1.0" encoding="utf-8"?> <configurationSnapshot xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:schemas-microsoft-com:xml-wcfconfigurationsnapshot"> <behaviors /> <bindings> <binding digest="System.ServiceModel.Configuration.BasicHttpBindingElement,System.ServiceModel,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089:<?xml version="1.0" encoding="utf-16"?><Data maxBufferSize="2147483647" name="CompareChartServiceSoap11Binding5"><security mode="None" /></Data>" bindingType="basicHttpBinding" name="CompareChartServiceSoap11Binding5" /> </bindings> <endpoints> <endpoint normalizedDigest="<?xml version="1.0" encoding="utf-16"?><Data address="http://localhost:8080/axis2/services/CompareChartService" binding="basicHttpBinding" bindingConfiguration="CompareChartServiceSoap11Binding5" contract="CompareChartService.CompareChartServicePortType" name="CompareChartServiceHttpSoap11Endpoint5" />" digest="<?xml version="1.0" encoding="utf-16"?><Data address="http://localhost:8080/axis2/services/CompareChartService" binding="basicHttpBinding" bindingConfiguration="CompareChartServiceSoap11Binding5" contract="CompareChartService.CompareChartServicePortType" name="CompareChartServiceHttpSoap11Endpoint5" />" contractName="CompareChartService.CompareChartServicePortType" name="CompareChartServiceHttpSoap11Endpoint5" /> </endpoints> </configurationSnapshot>
原来使用的是默认构造函数 ServiceEndpoint ep = new PAS.I1Service.CompareChartService.CompareChartServicePortTypeClient().Endpoint;
ServiceEndpoint ep = new PAS.I1Service.CompareChartService.CompareChartServicePortTypeClient("CompareChartServiceHttpSoap11Endpoint5").Endpoint; 从此次错误中发现,很多新错误确实从来都没接触过,此时不要急于地去搜索解决方案,而是先完全理解错误是什么。这样解决错误的效率就会高一些! (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读