使用WCF进行Kerberos身份验证customBinding

问题描述:

我正在使用ASMX Web服务并使用customBinding为服务创建WCF客户端。在customBinding安全部分中,我使用authenticationMode作为“KerberosOverTransport”并使用HTTP作为传输介质。请参阅下面的代码。使用WCF进行Kerberos身份验证customBinding

<customBinding> 
    <binding name="Service1Soap" closeTimeout="00:01:00" openTimeout="00:01:00" 
     receiveTimeout="00:10:00" sendTimeout="00:01:00"> 
     <security allowSerializedSigningTokenOnReply="true" authenticationMode="KerberosOverTransport" 
     requireDerivedKeys="false" messageProtectionOrder="SignBeforeEncryptAndEncryptSignature" 
     messageSecurityVersion="Default" requireSecurityContextCancellation="false"> 
     <secureConversationBootstrap /> 
     </security> 
     <textMessageEncoding messageVersion="Soap11" /> 
     <httpTransport authenticationScheme="Ntlm" unsafeConnectionNtlmAuthentication="false" /> 
    </binding> 
    </customBinding> 
</bindings> 
<client> 
    <endpoint address="http://localhost:1612/TestService.asmx" binding="customBinding" 
    bindingConfiguration="Service1Soap" contract="WCFProxy.Service1Soap" 
    name="Service1Soap" /> 
</client> 

当我创建一个Proxy类的实例并调用Web服务的Hello World方法时,出现以下异常。

“The'CustomBinding'。'' http://tempuri.org/'为'Service1Soap'绑定''urn:Service1'合同配置了一个需要传输级别完整性和机密性的身份验证模式,但传输不能提供完整性和机密性。

============================================== ============================================

at System .ServiceModel.Dispatcher.SecurityValidationBehavior.SoapOverSecureTransportRequirementsRule.ValidateSecurityBinding(SecurityBindingElement securityBindingElement,装订装订,ContractDescription合同) 在System.ServiceModel.Dispatcher.SecurityValidationBehavior.ValidateSecurityBinding(SecurityBindingElement SBE,装订装订,ContractDescription合同) 在System.ServiceModel.Dispatcher.SecurityValidationBehavior .ValidateBinding(绑定绑定,ContractDescription合同,SecurityBindingElement & securityBindingElement) 在System.ServiceModel.Dispatcher.SecurityValidationBehavior.System.ServiceModel.Description.IEndpointBehavior.Validate(ServiceEndpoint serviceEndpoint) 在System.ServiceModel.Description.ServiceEndpoint.Validate(布尔runOperationValidators,布尔isForService) 在System.ServiceModel.Channels.ServiceChannelFactory .BuildChannelFactory(ServiceEndpoint serviceEndpoint) 在System.ServiceModel.ChannelFactory.CreateFactory() 在System.ServiceModel.ChannelFactory.OnOpening() 在System.ServiceModel.Channels.CommunicationObject.Open(时间跨度超时) 在System.ServiceModel.ClientBase 1.System.ServiceModel.ICommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.ClientBase 1.在D:\ Rakesh \ Test Projects \ WebServiceCustomBinding \ WCFClient \ Program.cs中的WCFClient.Program.Main(String [] args)处打开() :line 16 在System.AppDomain._nExecuteAssembly(大会组件,字串[] args) 在System.AppDomain.ExecuteAssembly(字符串assemblyFile,证据assemblySecurity,字串[] args) 在Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 在System.Threading.ThreadHelper.ThreadStart_Context(对象状态) 在System.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象状态) 在System.Threading.ThreadHelper.ThreadStart()

我打不使用谷歌搜索这个例外运气。现在已经有2天了,其中有R & D部分。请给我提供一些关于这个问题的帮助。我会很高兴你的帮助!

Regards, Rakesh。

尝试使用basicHttpBinding的有以下安全,而不是:

<bindings> 
    <basicHttpBinding> 
    <binding name="Secured"> 
     <security mode="TransportCredentialOnly"> 
     <transport clientCredentialType="Windows" /> 
     </security> 
    </binding> 
    </basicHttpBinding> 
</bindings> 

你也可以检查此article - 有一个有关设置客户端部分。

+0

我已经尝试用basicHttpBinding之前customBinding开始。我使用customBinding的原因是我的应用程序需要与需要Kerberos身份验证才能实现SSO的Java Web服务进行互操作。 Java Web服务可能安装在除Windows以外的任何类型的平台上,因此在该平台上,Windows clientCredentialType可能无法正常工作。感谢您的回复。你能建议我一个解决方案提到的要求?对不起,以前没有提供这些细节! – 2010-08-26 05:19:16

+0

比您需要用于测试的Java Web服务。如果您的服务的WSDL具有描述其配置的安全策略,那将是非常棒的。目前,您正尝试使用与Java不同的ASMX来模拟服务。 – 2010-08-26 07:50:48

+0

是的,我明白。我的实际需求是在C#.NET中构建一个WCF客户端,它将实现Kerberos身份验证以实现SSO。这反过来会被用于认证用户和分配Kerberos令牌的Java Windows应用程序使用。目前Java应用程序还没有准备好,所以我试图让这个客户端只与ASMX Web服务一起工作。稍后,当使用ASMX服务成功进行测试时,我会尝试将此客户端与Java应用程序集成。 – 2010-08-27 05:45:35

尝试使用<httpsTransport requireClientCertificate="true"/>绑定元素。