Привязка сертификата SSL к порту программно

Иначе (на 2000 / 2005/2012/2014):

IF ((SELECT OBJECTPROPERTY( OBJECT_ID(N'table_name_here'), 'TableHasIdentity')) = 1)
    PRINT 'Yes'
ELSE
    PRINT 'No'

ПРИМЕЧАНИЕ: table_name_here должен быть schema.table, если схема не dbo.

6
задан dmo 9 November 2009 в 17:42
поделиться

3 ответа

Я считаю, что способ создания резервирования пространства имен HTTP.SYS - через HttpSetServiceConfiguration () неуправляемый API; поэтому для этого вам понадобится P / Invoke. Есть пример кода, который может быть полезен в одном из столбцов MSDN Кейта Брауна.

4
ответ дан 10 December 2019 в 00:40
поделиться

The MSDN documentation, Keith Brown's MSDN column, and pinvoke.net got me most of the way there. But getting the PSOCKADDR in the HTTP_SERVICE_CONFIG_SSL_KEY correct was tricky. I found Beej's Guide to Network Programming very helpful in figuring out what it should look like. I was able to use the .NET SocketAddress and then copy the bytes to an array that could be marshaled.

// serialize the endpoint to a SocketAddress and create an array to hold the values.  Pin the array.
SocketAddress socketAddress = ipEndPoint.Serialize();
byte[] socketBytes = new byte[socketAddress.Size];
GCHandle handleSocketAddress = GCHandle.Alloc(socketBytes, GCHandleType.Pinned);

// Should copy the first 16 bytes (the SocketAddress has a 32 byte buffer, the size will only be 16, which is what the SOCKADDR accepts
for (int i = 0; i < socketAddress.Size; ++i)
{
    socketBytes[i] = socketAddress[i];
}
2
ответ дан 10 December 2019 в 00:40
поделиться

Да, но вы должны сами использовать HTTP API , которого в настоящее время нет в .NET оболочка, поэтому вы должны использовать P / Invoke. В частности, я думаю, что вы ищете HttpSetServiceConfiguration с идентификатором конфигурации HttpServiceConfigSSLCertInfo.

1
ответ дан 10 December 2019 в 00:40
поделиться
Другие вопросы по тегам:

Похожие вопросы: