private BindToServer ( string serverName, uint encryptionMethod, uint authnSvc, string seqType, [ rpchUseSsl, string rpchAuthScheme, string spnStr, string options, [ setUuid ) : uint | ||
serverName | string | |
encryptionMethod | uint | |
authnSvc | uint | |
seqType | string | |
rpchUseSsl | [ | |
rpchAuthScheme | string | |
spnStr | string | |
options | string | |
setUuid | [ | |
return | uint |
/// <summary> /// Initialize the client and server and build the transport tunnel between client and server. /// </summary> private void InitializeRPC() { string serverName = Common.GetConfigurationPropertyValue("SutComputerName", this.site); string userName = Common.GetConfigurationPropertyValue("AdminUserName", this.site); string domainName = Common.GetConfigurationPropertyValue("Domain", this.site); string password = Common.GetConfigurationPropertyValue("AdminUserPassword", this.site); // Create identity for the user to connect to the server. OxnspiInterop.CreateIdentity( domainName, userName, password); MapiContext rpcContext = MapiContext.GetDefaultRpcContext(this.site); // Create Service Principal Name (SPN) string for the user to connect to the server. string userSpn = string.Empty; userSpn = Regex.Replace(rpcContext.SpnFormat, @"\[ServerName\]", serverName, RegexOptions.IgnoreCase); // Bind the client to RPC server. uint status = OxnspiInterop.BindToServer(serverName, rpcContext.AuthenLevel, rpcContext.AuthenService, rpcContext.TransportSequence, rpcContext.RpchUseSsl, rpcContext.RpchAuthScheme, userSpn, null, rpcContext.SetUuid); this.site.Assert.AreEqual <uint>(0, status, "Create binding handle with server {0} should success!", serverName); this.rpcBinding = OxnspiInterop.GetBindHandle(); this.site.Assert.AreNotEqual <IntPtr>(IntPtr.Zero, this.rpcBinding, "A valid RPC Binding handle is needed!"); }