无法使用给定的代理或引用来使用WCF客户端 [英] Unable to consume WCF client using proxy or reference given

查看:53
本文介绍了无法使用给定的代理或引用来使用WCF客户端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个wcf服务,当我直接点击该网址时我正在正确输出但是当我使用代理服务该服务或添加服务引用时,它给出了以下error.please帮助。



添加服务引用给出如下错误:



i have created a wcf service when ever i click that url directly i am getting output properly but when ever i am consuming that service using proxy or adding service reference its giving below error.please help.

adding service reference giving error like :

+		$exception	{"Could not find default endpoint element that references contract 'ServiceReference1.IAuthenticateService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."}	System.InvalidOperationException







添加代理客户端时出现以下错误:






while adding proxy client giving below error:

+		$exception	{"Manual addressing is enabled on this factory, so all messages sent must be pre-addressed."}	System.InvalidOperationException





我有什么ied:





What I have tried:

<system.servicemodel>
    <services>
      <service behaviorConfiguration="ServiceBehaviour" name="WcfService.AuthenticateService">
        <endpoint  address="" behaviorConfiguration="web" binding="webHttpBinding" contract="WcfService.IAuthenticateService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseaddresses>
            <add baseAddress="http://localhost/WcfService" />
          
        
      
    
    
    <bindings>
      <webhttpbinding>
        <!--<binding name="web">         
          <security mode="TransportCredentialOnly">
            <transport  clientCredentialType="Basic"/>
          
        -->
      
    
    <behaviors>
      <servicebehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false" />
        
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true"  />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <servicecredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom"
                                    customUserNamePasswordValidatorType="WcfService.AuthenticationValidation, WcfService"/>
          
        
      
      <endpointbehaviors>
        <behavior name="web">
          <webHttp helpEnabled="true" />
        
      
    
    <protocolmapping>
     
    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  



  <system.servicemodel>
    <bindings>
      <webhttpbinding>
        <binding name="webHttpBinding_IAuthenticateService" />
      
    
    <client>
      <endpoint address="http://localhost/WcfService"
                       binding="webHttpBinding"
                       bindingConfiguration="webHttpBinding_IAuthenticateService"
                       contract="WcfService.IAuthenticateService"
                       name="webHttpBinding_IAuthenticateService">

推荐答案

exception {找不到引用合同'ServiceReference1.IAuthenticateService'的默认端点元素ServiceModel客户端配置部分。这可能是因为没有为您的应用程序找到配置文件,或者因为在客户端元素中找不到与此合同匹配的端点元素。} System.InvalidOperationException
exception {"Could not find default endpoint element that references contract 'ServiceReference1.IAuthenticateService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element."} System.InvalidOperationException







添加代理客户端时出现以下错误:






while adding proxy client giving below error:

+


exception {在这个工厂启用了手动寻址,所以所有的信息都是发送的ges必须预先解决。} System.InvalidOperationException
exception {"Manual addressing is enabled on this factory, so all messages sent must be pre-addressed."} System.InvalidOperationException





我尝试过:





What I have tried:

<system.servicemodel>
    <services>
      <service behaviorConfiguration="ServiceBehaviour" name="WcfService.AuthenticateService">
        <endpoint  address="" behaviorConfiguration="web" binding="webHttpBinding" contract="WcfService.IAuthenticateService" />
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseaddresses>
            <add baseAddress="http://localhost/WcfService" />
          
        
      
    
    
    <bindings>
      <webhttpbinding>
        <!--<binding name="web">         
          <security mode="TransportCredentialOnly">
            <transport  clientCredentialType="Basic"/>
          
        -->
      
    
    <behaviors>
      <servicebehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the values below to false before deployment -->
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
          <serviceDebug includeExceptionDetailInFaults="false" />
        
        <behavior name="ServiceBehaviour">
          <serviceMetadata httpGetEnabled="true"  />
          <serviceDebug includeExceptionDetailInFaults="false" />
          <servicecredentials>
            <userNameAuthentication userNamePasswordValidationMode="Custom"
                                    customUserNamePasswordValidatorType="WcfService.AuthenticationValidation, WcfService"/>
          
        
      
      <endpointbehaviors>
        <behavior name="web">
          <webHttp helpEnabled="true" />
        
      
    
    <protocolmapping>
     
    
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
  



  <system.servicemodel>
    <bindings>
      <webhttpbinding>
        <binding name="webHttpBinding_IAuthenticateService" />
      
    
    <client>
      <endpoint address="http://localhost/WcfService"
                       binding="webHttpBinding"
                       bindingConfiguration="webHttpBinding_IAuthenticateService"
                       contract="WcfService.IAuthenticateService"
                       name="webHttpBinding_IAuthenticateService">


这篇关于无法使用给定的代理或引用来使用WCF客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆