WCF安全到底有多乱
BasicHttpBinding http = new BasicHttpBinding(); http.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; //这里的Type为BasicHttpBinding的Transport专有 http.Security.Mode = BasicHttpSecurityMode.Message; http.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;//这里的Type为BasicHttpBinding的Message专有 WSHttpBinding wsHttp = new WSHttpBinding(); wsHttp.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; //这里的Type为WsHttpBinding的Transport专有 wsHttp.Security.Message.ClientCredentialType = MessageCredentialType.UserName; //这里的Type为WsHttpBinding的Message专有 wsHttp.Security.Mode = SecurityMode.Message; NetTcpBinding nettcp = new NetTcpBinding(); nettcp.Security.Mode = SecurityMode.Message; nettcp.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows; //这里的Type为NetTcpBinding的Transport专有 nettcp.Security.Message.ClientCredentialType = MessageCredentialType.UserName; //这里的Type为NetTcpBinding的Message专有 nettcp.Security.Transport.ProtectionLevel = System.Net.Security.ProtectionLevel.EncryptAndSign;//这里的ProtectionLevel为NetTcpBinding的Transport专有 //注:如果使用非nettcpbinding,如果要对管道加密,要使用证书,当然这里如果不使用Windows验证也可以使用证书