繁体   English   中英

WCF用户名身份验证 - 教程中的异常

[英]WCF Username Authentication - exception in tutorial

我正在从这个页面做教程: http//msdn.microsoft.com/en-us/library/gg185927.aspx我想我做的一切都好,但我得到了这个例外:

   `An error occurred when processing the security tokens in the message.`

我做错了什么? 我使用了样品证书。 也许我应该创建自己的证书? 有什么区别吗?

我注意到硬编码凭证与教程中传递的略有不同,因此我在Services Identites中更改了它们。 在我这样做之前,我收到了身份验证异常,因此我认为可以更改它。

我没有任何安全方面的经验,但我想最终学习它,所以我希望你们能帮助我:)

编辑:我不确定这个王国是否还可以。 我在那里通过了http://localhost:7100/Service/Default.aspx 我在我的本地机器上运行它,我不确定它是否应该这样做。 编辑2:这是StackTrace:

Server stack trace: 
at  System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.ProcessReply(Message reply, SecurityProtocolCorrelationState correlationState, TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.SecurityRequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]: 
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at WcfService.IStringService.Reverse(String value)
at WcfClient.Program.Main(String[] args) in c:\Users\Hador\Downloads\Windows Azure AD Access Control (ACS) Code Samples\C#\Webservice\Acs2UsernameBindingSample\WcfClient\Program.cs:line 53

我有这个错误:

string outputString = stringService.Reverse(userInputString);

似乎您的问题与令牌加密策略有关,并且其中需要安全性......

“令牌加密策略

令牌加密策略确定ACS为依赖方应用程序发出的令牌是否已加密。 要要求加密,请选择“要求加密”值。

在ACS中,您只能为SAML 2.0或SAML 1.1令牌配置加密策略。 ACS不支持加密SWT或JWT令牌。

ACS使用包含公钥(.cer文件)的X.509证书加密SAML 2.0和SAML 1.1令牌。 然后,通过使用依赖方应用程序拥有的私钥来解密这些加密的令牌。 有关获取和使用加密证书的详细信息,请参阅证书和密钥。

在ACS发布的令牌上配置加密策略是可选的。 但是,当您的依赖方应用程序是通过WS-Trust协议使用证明拥有令牌的Web服务时,必须配置加密策略。 没有加密令牌,这种特殊情况无法正常运行。“ 从这里开始

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM