在 ServiceModel 客户端配置部分中,找不到引用协定“PmWs.PmWebServiceSoap”的默认终结点元素

System.Exception: ConfigManager.LoadConfigurationFromDb
ServiceFactory.GetPmWebService
在 ServiceModel 客户端配置部分中,找不到引用协定“PmWs.PmWebServiceSoap”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为客户端元素中找不到与此协定匹配的终结点元素。 ---> System.Exception: ServiceFactory.GetPmWebService
在 ServiceModel 客户端配置部分中,找不到引用协定“PmWs.PmWebServiceSoap”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为客户端元素中找不到与此协定匹配的终结点元素。 ---> System.InvalidOperationException: 在 ServiceModel 客户端配置部分中,找不到引用协定“PmWs.PmWebServiceSoap”的默认终结点元素。这可能是因为未找到应用程序的配置文件,或者是因为客户端元素中找不到与此协定匹配的终结点元素。
   在 System.ServiceModel.Description.ConfigLoader.LoadChannelBehaviors(ServiceEndpoint serviceEndpoint, String configurationName)
   在 System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName, Configuration configuration)
   在 System.ServiceModel.ChannelFactory.ApplyConfiguration(String configurationName)
   在 System.ServiceModel.ChannelFactory.InitializeEndpoint(String configurationName, EndpointAddress address)
   在 System.ServiceModel.ChannelFactory`1..ctor(String endpointConfigurationName, EndpointAddress remoteAddress)
   在 System.ServiceModel.ConfigurationEndpointTrait`1.CreateSimplexFactory()
   在 System.ServiceModel.ConfigurationEndpointTrait`1.CreateChannelFactory()
   在 System.ServiceModel.ClientBase`1.CreateChannelFactoryRef(EndpointTrait`1 endpointTrait)
   在 System.ServiceModel.ClientBase`1.InitializeChannelFactoryRef()
   在 System.ServiceModel.ClientBase`1..ctor()
   在 PmLib.PmWs.PmWebServiceSoapClient..ctor()
   在 PmLib.Business.ServiceFactory.GetPmWebService()
   --- 内部异常堆栈跟踪的结尾 ---
   在 PmLib.Business.ServiceFactory.GetPmWebService()
   在 PmLib.Business.DataManager..ctor()
   在 PmLib.Business.ConfigManager.LoadConfigurationFromDb(String MacAddress)
   --- 内部异常堆栈跟踪的结尾 ---
   在 PmLib.Business.ConfigManager.LoadConfigurationFromDb(String MacAddress)
   在 PmWebService.GetExistList(String mac) 位置 e:\work\\WebDev\xwx_szrcb\Center\WebPages\eMBS\App_Code\PmWebService.cs:行号 211

错误如上,解决方式很简单。在 web.config ServiceModel 文件加入 Soap 协议  

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="KioskServiceSoap" />
        <binding name="TaskSoap" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
        <binding name="Service1Soap" />
        <binding name="ImageServiceSoap" maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
        <binding name="PmWebServiceSoap" maxBufferPoolSize="2147483647"
          maxReceivedMessageSize="2147483647">
          <readerQuotas maxDepth="32" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://192.168.1.231/WebKioskService/KioskService.asmx"
        binding="basicHttpBinding" bindingConfiguration="KioskServiceSoap"
        contract="refCenterKioskService.KioskServiceSoap" name="KioskServiceSoap" />
      <endpoint address="http://105.1.1.142/FDSService/Task.asmx" binding="basicHttpBinding"
        bindingConfiguration="TaskSoap" contract="ClientTask.TaskSoap"
        name="TaskSoap" />
      <endpoint address="http://105.1.1.142/advance/Service1.asmx"
        binding="basicHttpBinding" bindingConfiguration="Service1Soap"
        contract="ClientService1.Service1Soap" name="Service1Soap" />
      <endpoint address="http://105.1.1.142/FDSService/ImageService.asmx"
        binding="basicHttpBinding" bindingConfiguration="ImageServiceSoap"
        contract="CallClient_ImageService.ImageServiceSoap" name="ImageServiceSoap" />
      <endpoint address="http://192.168.1.231/PmWebService.asmx" binding="basicHttpBinding"
        bindingConfiguration="PmWebServiceSoap" contract="PmWs.PmWebServiceSoap"
        name="PmWebServiceSoap" />
    </client>
  </system.serviceModel>

 

posted @ 2015-08-10 10:12  许大虾  阅读(1980)  评论(0编辑  收藏  举报