WCF提供不安全或不正确安全的故障错误 [英] WCF gives an unsecured or incorrectly secured fault error
问题描述
我试图消耗远程SVC Web服务。我创建使用 svcutil.exe的
,在那之后我添加了类,我的控制台应用程序代理类,但它会产生一个错误:
这是不安全的错误或不正确的故障保护从对方收到。请参阅故障代码和详细的内部故障异常。
System.ServiceModel.FaultException:为消息
块引用>
验证的安全性时发生错误我没有创建WCF的一面,这是一个远程SVC。请帮忙
<预类=郎咸平的XML prettyprint-覆盖><?XML版本=1.0 编码=UTF-8>?;
<结构>
< system.serviceModel>
<&绑定GT;
<&basicHttpBinding的GT;
<绑定名称=EloquaDataTransferServicecloseTimeout =00:01:00
openTimeout =00:01:00receiveTimeout =00:10:00的SendTimeout =00:01: 00
allowCookies =假bypassProxyOnLocal =假hostNameComparisonMode =StrongWildcard
MAXBUFFERSIZE =65536maxBufferPoolSize =524288maxReceivedMessageSize =65536
messageEncoding =MTOMtextEncoding =UTF-8transferMode =缓冲
useDefaultWebProxy =真正的>
< readerQuotas MAXDEPTH =32maxStringContentLength =8192maxArrayLength =16384
maxBytesPerRead =4096maxNameTableCharCount =16384/>
<安全模式=TransportWithMessageCredential>
<运输clientCredentialType =无proxyCredentialType =无
境界=/>
<消息clientCredentialType =用户名algorithmSuite =默认/>
< /安全>
< /&结合GT;
< / basicHttpBinding的>
< /绑定>
<客户端>
<端点地址=https://secure.eloqua.com/API/1.2/DataTransferService.svc
结合=basicHttpBinding的bindingConfiguration =EloquaDataTransferService
合同=DataTransferService NAME =EloquaDataTransferService/>
< /客户>
< /system.serviceModel>
< /结构>
这是我的
的app.config
文件。我提供我的consoleApp.cs
使用文件的用户名和密码obj.ServiceCredentials.UserName.UserName =XXXXXX
和。密码=XXXXX
<预类=郎咸平的XML prettyprint-覆盖><?XML版本=1.0编码=UTF-8>?;
<结构>
< system.serviceModel>
<&绑定GT;
<&basicHttpBinding的GT;
<绑定名称=EloquaDataTransferServicecloseTimeout =00:01:00openTimeout =00:01:00receiveTimeout =00:10:00的SendTimeout =00:01:00allowCookies = 假bypassProxyOnLocal =假hostNameComparisonMode =StrongWildcardMAXBUFFERSIZE =65536maxBufferPoolSize =524288maxReceivedMessageSize =65536messageEncoding =MTOMtextEncoding =UTF-8transferMode =缓冲useDefaultWebProxy =真 >
< readerQuotas MAXDEPTH =32maxStringContentLength =8192maxArrayLength =16384maxBytesPerRead =4096maxNameTableCharCount =16384/>
<安全模式=TransportWithMessageCredential>
<运输clientCredentialType =无proxyCredentialType =无的境界=/>
<消息clientCredentialType =用户名algorithmSuite =默认/>
< /安全>
< /&结合GT;
< / basicHttpBinding的>
< /绑定>
<客户端>
<端点地址=https://secure.eloqua.com/API/1.2/DataTransferService.svc绑定=basicHttpBinding的bindingConfiguration =EloquaDataTransferService合同=DataTransferServiceNAME =EloquaDataTransferService/> ;
< /客户>
< /system.serviceModel>
< /结构>
解决方案这是一个非常模糊的错,WCF服务抛出。问题是,WCF是无法验证传递给服务的消息的安全性。
这是因为服务器的时滞几乎总是如此。远程服务器和客户端的系统时间必须(一般),每次10分钟等的范围内。如果不是,安全验证失败。
我会打电话eloqua.com并找出他们的服务器是什么时候了,和比较,为您的服务器时间。
I am trying to consume a remote svc web service. I created the proxy class using
svcutil.exe
, and after that I've added that class to my console application, but it yields an error:An unsecured error or incorrectly secured fault was received from the other party. See the inner fault exception for the fault code and detail.
System.ServiceModel.FaultException: An error occurred when verifying security for the message
I didn't create the WCF side, it's a remote svc. Please help.
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="EloquaDataTransferService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="TransportWithMessageCredential"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="https://secure.eloqua.com/API/1.2/DataTransferService.svc" binding="basicHttpBinding" bindingConfiguration="EloquaDataTransferService" contract="DataTransferService" name="EloquaDataTransferService" /> </client> </system.serviceModel> </configuration>
This is my
app.config
file. I am providing the username and password in myconsoleApp.cs
file usingobj.ServiceCredentials.UserName.UserName="xxxxxx"
and.Password="xxxXx"
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="EloquaDataTransferService" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Mtom" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="TransportWithMessageCredential"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="https://secure.eloqua.com/API/1.2/DataTransferService.svc" binding="basicHttpBinding" bindingConfiguration="EloquaDataTransferService" contract="DataTransferService" name="EloquaDataTransferService" /> </client> </system.serviceModel> </configuration>
解决方案This is a very obscure fault that WCF services throw. The issue is that WCF is unable to verify the security of the message that was passed to the service.
This is almost always because of a server time skew. The remote server and the client's system time must be within (typically) 10 minutes of each other. If they are not, security validation will fail.
I'd call eloqua.com and find out what their server time is, and compare that to your server time.
这篇关于WCF提供不安全或不正确安全的故障错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!