2016-04-18 19 views
1

Ich habe den Code für IdentityServer von here heruntergeladen. Wenn ich die IdentityServer3 \ Host.Web-Lösung in IIS Express ausführe, kann ich mich mit der Methode TokenClient.RequestResourceOwnerPasswordAsync von einem Konsolenclient authentifizieren.IdentityServer3 kann nicht in IIS ausgeführt werden

aber sobald ich IdentityServer3 \ Host.Web wechseln direkt unter IIS laufen, erhalte ich die folgende Fehlermeldung:

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. 

Was muss ich anders konfigurieren IdentityServer3 erhalten unter IIS zu arbeiten?

+0

Ist anonyme Authentifizierung zulässig. –

+0

@BrockAllen - Die anonyme Authentifizierung ist aktiviert, es stellt sich jedoch heraus, dass die Standardauthentifizierung ebenfalls aktiviert wurde. Durch das Deaktivieren der Standardauthentifizierung ignoriert IIS die Authentifizierungsheader und der Identitätsserver funktioniert einwandfrei. – RQDQ

+0

Ah, macht Sinn. –

Antwort

0

Lösung 1:

Es sieht aus wie eine Lösung für dieses Problem ist den Authentifizierungstyp PostValues ​​zu ändern:

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

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

Beachten Sie, dass die AuthenticationStyle im Konstruktor festlegen. Das Festlegen nach der Erstellung ist problematisch, da die Authentifizierungsheader im Konstruktor bedingt erstellt werden.

Lösung 2:

Disable "Basic Authentication" in IIS-Einstellungen.

Verwandte Themen