2015-04-01 180 views
1

我在客户端收到异常,并处理来自外部供应商的wcf服务,如"The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'Basic realm="CASM"'". 我正在从webservice请求大数据,越来越exception.In.Inting事情是我从wcf服务获取一些数据,然后得到异常。所以我假设我是否需要微调请求?所以我不应该一次询问大数据,或者这是一个不同的问题。我确实喜欢显示“Error when adding web service reference in VS2012”的帖子,但没有运气。 任何人都可以告诉我什么是这个例外背后的可能原因。下面是我的webconfig一部分,我在我的代码起诉的用户名和密码Wcf服务异常“HTTP请求未经客户端认证方案授权”

<binding name="Test" closeTimeout="00:01:00" openTimeout="00:01:00" 
     receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" 
     bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" 
     maxBufferSize="6553600" maxBufferPoolSize="524288" maxReceivedMessageSize="6553600" 
     messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" 
     useDefaultWebProxy="true"> 
     <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" 
     maxBytesPerRead="4096" maxNameTableCharCount="16384" /> 
     <security mode="TransportCredentialOnly"> 
     <transport clientCredentialType="Basic" proxyCredentialType="Basic" 
      realm="" /> 
     <message clientCredentialType="UserName" algorithmSuite="Default" /> 
     </security> 
    </binding> 
    <endpoint address="http://testurl/as" binding="basicHttpBinding" 
    bindingConfiguration="Test" contract="Testservice.Test" name="Test"> 
    </endpoint> 

UPDATE

一两件事,这是什么realm="CASM"异常,我不能够在客户端配置设置,智能感知是不给

回答

0

试图改变这种

<security mode="TransportCredentialOnly"> 
    <transport clientCredentialType="Basic" proxyCredentialType="Basic" 
     realm="" /> 
    <message clientCredentialType="UserName" algorithmSuite="Default" /> 
    </security> 

这一行

<security mode="TransportCredentialOnly"> 
    <transport clientCredentialType="Anonymous"/> 
    <message clientCredentialType="UserName" algorithmSuite="Default"/> 
</security> 
+0

我这样做了,即使我在我的问题中发布了相同的链接 – peter 2015-04-01 11:15:40

+0

如何使用WSDL或httpwebrequest调用服务? – Coder1409 2015-04-01 11:21:11

+0

我用wsdl来调用webservice,来创建proxy.I做我自己的xmlserialization的每个请求和respone.May可能会出现问题吗?但是有点事情是我从webservice得到一些数据s – peter 2015-04-01 11:28:29

相关问题