【问题标题】:Unable to run IdentityServer3 in IIS无法在 IIS 中运行 IdentityServer3
【发布时间】:2016-08-10 16:00:07
【问题描述】:

我已经从here 下载了 IdentityServer 的代码。在 IIS Express 中运行 IdentityServer3\Host.Web 解决方案时,我可以使用 TokenClient.RequestResourceOwnerPasswordAsync 方法从控制台客户端进行身份验证。

但是,当我切换 IdentityServer3\Host.Web 以直接在 IIS 下运行时,我收到以下错误:

HTTP Error 401.1 - Unauthorized 
You do not have permission to view this directory or page using the credentials that you supplied.
Most likely causes:
- The username supplied to IIS is invalid.
- The password supplied to IIS was not typed correctly.
- Incorrect credentials were cached by the browser.
- IIS could not verify the identity of the username and password provided.
- The resource is configured for Anonymous authentication, but the configured anonymous account either has an invalid password or was disabled.
- The server is configured to deny login privileges to the authenticating user or the group in which the user is a member.
- Invalid Kerberos configuration may be the cause if all of the following are true:
    - Integrated authentication was used.
    - the application pool identity is a custom account.
    the server is a member of a domain.

为了让 IdentityServer3 在 IIS 下工作,我必须进行哪些不同的配置?

【问题讨论】:

  • 是否允许匿名身份验证。
  • @BrockAllen - 启用了匿名身份验证,但事实证明也启用了基本身份验证。通过禁用基本身份验证,IIS 会忽略身份验证标头,并且身份服务器可以正常工作。

标签: identityserver3


【解决方案1】:

解决方案 1:

看起来解决方案是将身份验证类型更改为 PostValues:

var client = new TokenClient(
            authenticationUrl,
            "carbon",
            "21B5F798-BE55-42BC-8AA8-0025B903DC3B",
            AuthenticationStyle.PostValues);

var token = await client.RequestResourceOwnerPasswordAsync("bob", "secret", "api1");

请注意,您必须在构造函数中设置 AuthenticationStyle。在构造之后设置它是有问题的,因为身份验证头是在构造函数中有条件地创建的。

解决方案 2:

在 IIS 设置中禁用“基本身份验证”。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 2017-12-20
    • 1970-01-01
    • 2020-10-05
    • 2013-03-17
    • 1970-01-01
    相关资源
    最近更新 更多