问题
I recently started using a custom ServiceHostFactory because I want to use dependency injection with WCF. Both my client and service are being run from VS2010 on my local machine and the service is using the ASP.NET Development Server. Why am I having this problem now? I've had success with wsHttpSecurity in the past, having both the client and service on my local machine. I really think the only difference here is the use of a ServiceHostFactory. I've tried using the userPrincipalName attribute but I'm not even sure what I should be putting in for the value. Should it be MachineName\username? Will this attribute make a difference? I'd greatly appriciate any help you can provide.
回答1:
UserNamePrincipal describes service credentials. If you set UPN to some account you claim that service will be hosted in process running under that account. This information is passed in WSDL to client. When client opens channel to the service it first validate that service is running under claimed account (some security handshake). If not exception is thrown because service is not authenticated. If you run the service on development server you have to set UPN to your current account.
来源:https://stackoverflow.com/questions/3615076/getting-the-security-support-provider-interface-sspi-negotiation-failed-when