本文介绍了无法使用给定的代理或引用来使用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">
推荐答案
添加代理客户端时出现以下错误:
while adding proxy client giving below error:
+
我尝试过:
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客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!