Win32Exception:The target principal name is incorrect when calling a WCF service with WebClient

后端 未结 2 1129
萌比男神i
萌比男神i 2021-01-24 08:14

I put together a quick chunk of example code with linqpad showing a WCF webservice call without creating a proxy class from the WSDL. Here\'s what I have:

using         


        
2条回答
  •  北恋
    北恋 (楼主)
    2021-01-24 09:14

    Try using AuthenticationManager.CustomTargetNameDictionary to specify the SPN you want to use when invoking that URL with WebClient:

    http://blogs.msdn.com/b/jpsanders/archive/2009/03/20/httpwebrequest-class-does-not-use-port-number-in-spn-when-using-kerberos.aspx

    http://msdn.microsoft.com/en-us/library/system.net.authenticationmanager.customtargetnamedictionary.aspx

提交回复
热议问题