Connect a self-hosted WCF-Service via WebHttpBinding fails in Kerberos-Mode

Floyd

I have a self-hosted WCF service that is accessible using WebHttpBinding. This service should get a kerberos token from the internet explorer on the client and then he should impersonate with this token to access an file server via a network share on an other server.

Like this chain:

IE (Client) -> WCF-Service (BI-Server) -> impersonate -> access network share on file server

But IE presents a login dialog if I change the ClientCredentialType or add an ServiceAuthenticationBehavior with Kerberos settings (401 Unauthorized).

With NTLM I can access the WCF service and impersonate but the access to the file server leads to an UnauthorizedAccessException.

The same server has also a NetTcpBinding with Kerberos which works fine.

What am I doing wrong?

Delegation for Kerberos (all services) is activated on the BI server.

  • ADS-Functional Level is 2012
  • File server is a Windows Server 2003
  • WCF/IIS-Host is a Windows Server 2012 R2
  • Client is a Windows 8, IE 10

Now the code for the channel:

var listenUrl =  "http://0.0.0.0:8735";

var bind = new WebHttpBinding(WebHttpSecurityMode.TransportCredentialOnly)
{
         Security = {Transport = {ClientCredentialType = HttpClientCredentialType.InheritedFromHost}},
         TransferMode = TransferMode.StreamedResponse
};

var host = new WebServiceHost(typeof(C_SIS), new Uri(listenUrl));
host.AddServiceEndpoint(typeof(IW_SIS), bind, "").Behaviors.Add(new WebHttpBehavior());

ServiceAuthenticationBehavior sab = null;
sab = host.Description.Behaviors.Find<ServiceAuthenticationBehavior>();
if (sab == null)
{
         sab = new ServiceAuthenticationBehavior();
         sab.AuthenticationSchemes = AuthenticationSchemes.Negotiate | AuthenticationSchemes.Ntlm;
         host.Description.Behaviors.Add(sab);
}
else
{
         sab.AuthenticationSchemes = AuthenticationSchemes.Negotiate | AuthenticationSchemes.Ntlm;
}

host.UnknownMessageReceived += new EventHandler<UnknownMessageReceivedEventArgs>(UnbekannterRecv);
host.Open();
Floyd

At first, check that your service run with a Domain-User. Then you must set an SPN (Service Principal Name) for this User.

setspn -s http\wcfHostMachineName:PORT DOAMIN\User
setspn -s http\wcfHostMachineName.FULLDomain.Quantifier:PORT DOAMIN\User

Clear all Kerberos-Tokens on your client with

klist -purge

Try it. If it works -> fine. But if not open your ADS-User-Configuration and delete all http-SPN's without port form the wcfHost, not the User! The wcfHost dosent need seperate SPN's.

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Self-hosted WCF service works with HTTP not with HTTPS

分類Dev

Self-Hosted WCF - Namespace Reservation required?

分類Dev

SSIS Project Fails To Build On Self Hosted Agent

分類Dev

Unable to consume WCF service (hosted in IIS )

分類Dev

Connect containerized self-hosted agent with Azure DevOps

分類Dev

WCF hosted with IIS performance Tuning

分類Dev

Combining self hosted and Azure hosted agents in the same pool

分類Dev

Python Selenium "Can not connect to the Service %s" % self.path in linux server

分類Dev

WCFはwebhttpbindingでデュプレックスを無視します

分類Dev

docker-compose can't connect to adjacent service via service name

分類Dev

Running NPM on a self-hosted VSO Agent

分類Dev

Routing is not working with self-hosted web API

分類Dev

SignalR Self Hosted And Asp.Net MVC

分類Dev

WCF Service BadImageFormatException

分類Dev

Wcf web service

分類Dev

WCF "Basic" transport security issue when hosted in IIS

分類Dev

using statement inside a WCF Service

分類Dev

WCF Endpoint not found for service interface

分類Dev

WCF413リクエストエンティティが大きすぎます-セルフホストWebHttpBinding

分類Dev

JMeterでWebHttpBindingを使用してWCFサービスの負荷テストを実行する方法

分類Dev

WCF hosted in WPF and how can i change control in MainWindow UI from wcf?

分類Dev

Can I use AWS AppSync with self-hosted PostgreSQL?

分類Dev

secure read-only self hosted git repository for scripts

分類Dev

Connect to Postgres DB with Kerberos from Java/Windows7

分類Dev

.NET Core Difference between Hosted Service and Singleton Service

分類Dev

Running Selenium Tests in Chrome (Headless mode) on a VSTS Hosted Agent

分類Dev

WCFはKerberosとどのように連携しますか?

分類Dev

WCF with Kerberos Authentication: The request for security token could not be satisfied because authentication failed

分類Dev

WCFはKerberosとどのように連携しますか?

Related 関連記事

  1. 1

    Self-hosted WCF service works with HTTP not with HTTPS

  2. 2

    Self-Hosted WCF - Namespace Reservation required?

  3. 3

    SSIS Project Fails To Build On Self Hosted Agent

  4. 4

    Unable to consume WCF service (hosted in IIS )

  5. 5

    Connect containerized self-hosted agent with Azure DevOps

  6. 6

    WCF hosted with IIS performance Tuning

  7. 7

    Combining self hosted and Azure hosted agents in the same pool

  8. 8

    Python Selenium "Can not connect to the Service %s" % self.path in linux server

  9. 9

    WCFはwebhttpbindingでデュプレックスを無視します

  10. 10

    docker-compose can't connect to adjacent service via service name

  11. 11

    Running NPM on a self-hosted VSO Agent

  12. 12

    Routing is not working with self-hosted web API

  13. 13

    SignalR Self Hosted And Asp.Net MVC

  14. 14

    WCF Service BadImageFormatException

  15. 15

    Wcf web service

  16. 16

    WCF "Basic" transport security issue when hosted in IIS

  17. 17

    using statement inside a WCF Service

  18. 18

    WCF Endpoint not found for service interface

  19. 19

    WCF413リクエストエンティティが大きすぎます-セルフホストWebHttpBinding

  20. 20

    JMeterでWebHttpBindingを使用してWCFサービスの負荷テストを実行する方法

  21. 21

    WCF hosted in WPF and how can i change control in MainWindow UI from wcf?

  22. 22

    Can I use AWS AppSync with self-hosted PostgreSQL?

  23. 23

    secure read-only self hosted git repository for scripts

  24. 24

    Connect to Postgres DB with Kerberos from Java/Windows7

  25. 25

    .NET Core Difference between Hosted Service and Singleton Service

  26. 26

    Running Selenium Tests in Chrome (Headless mode) on a VSTS Hosted Agent

  27. 27

    WCFはKerberosとどのように連携しますか?

  28. 28

    WCF with Kerberos Authentication: The request for security token could not be satisfied because authentication failed

  29. 29

    WCFはKerberosとどのように連携しますか?

ホットタグ

アーカイブ