webservices设置web.config供远程调用
在网站的解决方案的下方找到web.config
<system.web> <webServices> <protocols> <add name="HttpGet"/> <add name="HttpPost"/> </protocols> </webServices> <system.web>
2.无法加载协定为“ServiceReference1.xxxxxx”的终结点配置部分,因为找到了该协定的多个终结点配置。请按名称指示首选的终结点配置部分。
原因是在web.config 文件中多次引用了“添加外部引用”
<system.serviceModel> <bindings> <basicHttpBinding> <binding name="WebServiceSoap" /> <binding name="WebServiceSoap1" /> </basicHttpBinding> </bindings> <client> <endpoint address="http://10.29.68.32/WebService.asmx" binding="basicHttpBinding" bindingConfiguration="WebServiceSoap" contract="ServiceReference.WebServiceSoap" name="WebServiceSoap" /> <endpoint address="http://10.29.68.32/WebService.asmx" binding="basicHttpBinding" bindingConfiguration="WebServiceSoap1" contract="ServiceReference.WebServiceSoap" name="WebServiceSoap1" /> </client> </system.serviceModel>
所以删掉一个节点既可(如查引用的是WebServiceSoap,删掉WebServiceSoap1的有关节点,反之~)
也可以在页面引用的时候指定bindingConfiguration名字:
如:ServiceReference.WebServiceSoap web = new WebServiceSoapClient("WebServiceSoap");
3.
在调用webservice返回数据的时候, 出现以下错误:
已超过传入消息(65536)的最大消息大小配额。若要增加配额,请使用相应绑定元素上的 MaxReceivedMessageSize 属性
这个就需要在调用webservice的解决方案中,在web.config或者app.config中配置一下:注意红色字体为哪个节点下加的哪些配置。
<system.serviceModel> <bindings > <basicHttpBinding> <binding name="InterfaceSoap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" /> </basicHttpBinding> <customBinding> <binding name="InterfaceSoap12" > <textMessageEncoding messageVersion="Soap12" /> <httpTransport /> </binding> </customBinding> </bindings> <client> <endpoint address="http://218.90.168.115:8000/PJSDFacade/PJSD/Interface.asmx" binding="basicHttpBinding" bindingConfiguration="InterfaceSoap" contract="ServiceReference.InterfaceSoap" name="InterfaceSoap" /> </client> </system.serviceModel>
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(1)