WCF:无法满足对安全令牌的请求,因为身份验证失败 [英] WCF: The request for security token could not be satisfied because authentication failed

查看:41
本文介绍了WCF:无法满足对安全令牌的请求,因为身份验证失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个非常简单的 WCF 服务来发送和接收消息.我已经通过 VS 2008 默认 Web 服务器主机测试了该应用程序,一切正常.但是当我将 WCF 服务部署到另一台计算机的 IIS 时,我收到以下错误:

I have written a very simple WCF Service that sends and receives messages. I have tested the app through the VS 2008 default web server host and everything works fine. But when I deploy the WCF service to another computer's IIS I receive the following error:

由于身份验证失败,无法满足安全令牌请求."

如何在配置文件中设置身份验证类型以使用我的自定义用户名和密码?如果不可能,请告诉我如何设置其 Windows 凭据,因为我使用的 2 台计算机不共享相同的用户.

How can I set the authentication type to use my custom username and password in config file? If it is not possible, please tell me how I can set its windows credentials because the 2 computers that I'm using, don't share the same users.

推荐答案

您需要关闭绑定的安全性.否则,我相信默认情况下 wsHttpBinding 将尝试协商安全上下文令牌 (SCT).

You need to turn off security for the binding. Otherwise, I believe that, by default, the wsHttpBinding will try to negotiate a Security Context Token (SCT).

因此,修改端点定义以指向绑定配置部分.举个例子:

So, modify the endpoint definition to point to a binding configuration section. Here's an example:

<endpoint address="" 
          binding="wsHttpBinding" 
          contract="HelloWorldService.IService1"
          bindingConfiguration="TheBindingConfig">

然后在 web.config 的 部分的 部分之后添加类似以下绑定配置的内容.

And then add something like the following binding configuration right after the <services> section in the web.config's <system.serviceModel> section.

<bindings>
  <wsHttpBinding>
    <binding name="TheBindingConfig">
      <security mode="None" />
    </binding>
  </wsHttpBinding>
</bindings>

将安全设置为无"是关键.

Setting security to "None" is the key.

希望这有帮助!

以上对我有帮助 - 但不是很明显的是如何添加到 service 端(一旦你完成了需要什么就很清楚了,但直到你这样做了才知道).它不完全明显的原因是因为默认情况下没有绑定部分,而客户端中可能有一个.

The above helped me - but what is not immediately obvious is how to add to the service end (its clear once you've done it what's needed, but not until you've done so). The reason its not entirely obvious is because there isn't a bindings section by default whereas there is liable to be one in the client.

所以,要非常清楚 - 在服务端,添加绑定部分(如上所述),然后在适当的端点添加 bindingConfiguration="TheBindingConfig" 属性.做过一次就很明显了...

So, just to be very clear - at the service end, add the bindings section (as detailed above) and then to the appropriate endpoint add the bindingConfiguration="TheBindingConfig" attribute. Obvious once you've done it once...

这篇关于WCF:无法满足对安全令牌的请求,因为身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆