在引用WebService作为服务引用的时候,由于VS生成时生成了两个入口点,导致出现

引发的异常:“System.Windows.Markup.XamlParseException”(位于 PresentationFramework.dll 中)

其他信息: 'The invocation of the constructor on type 'WebServiceInvokingDemo.MainWindow' that matches the specified binding constraints threw an exception.' Line number '6' and line position '9'.

引用WebService出现错误

解决办法

      打开程序的App.Config

找到节点

bindings节点下只能有一个
Client 节点下智能有一个

 <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="Service1Soap" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"/>
                <binding name="IotServiceSoap"/>
            </basicHttpBinding>
            
        </bindings>
    
        <client>
            <endpoint address="http://192.168.0.41:5/BHService.asmx" binding="basicHttpBinding" bindingConfiguration="Service1Soap" contract="BHService.Service1Soap" name="Service1Soap"/>
            <endpoint address="http://192.168.0.121:8/IotService.asmx" binding="basicHttpBinding" bindingConfiguration="IotServiceSoap" contract="IotSrf.IotServiceSoap" name="IotServiceSoap"/>
            
        </client>
    </system.serviceModel>

 

如果不修改App.config 可以通过指定入口的方式

 

MesService.Service1Soap m_MesServer = new MesService.Service1SoapClient(“IotServiceSoap”);

  

相关文章:

  • 2021-12-31
  • 2021-11-22
  • 2021-12-22
  • 2021-10-18
  • 2022-01-19
  • 2021-07-03
猜你喜欢
  • 2021-11-27
  • 2021-07-01
  • 2022-01-07
  • 2022-12-23
  • 2021-08-18
  • 2022-12-23
  • 2021-11-07
相关资源
相似解决方案