TsgcWebSocketServer_HTTPAPI › 属性 › BindingOptions
精细控制 URL 保留项和 SSL 证书在启动时向 http.sys 驱动程序注册的方式。
property BindingOptions: TsgcWSBindings_Options_HTTPAPI read FBindingOptions write SetBindingOptions;
ConfigureSSLCertificate=True
当 ConfigureSSLCertificate 为 True(默认值)时,每次将 Active 设置为 True 时,服务器会自动保留 URL 并附加由 SSLOptions.Hash 标识的 SSL 证书——这需要进程以管理员权限运行。如果您已经在外部注册了 URL 并绑定了证书(例如使用 netsh http add urlacl 和 netsh http add sslcert),请将其设置为 False;服务器将在不请求提升权限的情况下启动。该属性仅影响激活序列——运行时行为在两种情况下完全相同。
oServer := TsgcWebSocketServer_HTTPAPI.Create(nil);
oServer.Host := '127.0.0.1';
oServer.Port := 443;
oServer.SSL := true;
oServer.SSLOptions.Hash := 'CERTIFICATE_HASH';
// URL and certificate already registered with netsh: skip the admin-only step
oServer.BindingOptions.ConfigureSSLCertificate := false;
oServer.Active := true;