private unsafe void DetachRequestQueueFromUrlGroup() { Debug.Assert(_urlGroupId != 0, "DetachRequestQueueFromUrlGroup can't detach using Url group id 0."); // Break the association between request queue and url group. After this, requests for registered urls // will get 503s. // Note that this method may be called multiple times (Stop() and then Abort()). This // is fine since http.sys allows to set HttpServerBindingProperty multiple times for valid // Url groups. UnsafeNclNativeMethods.HttpApi.HTTP_BINDING_INFO info = new UnsafeNclNativeMethods.HttpApi.HTTP_BINDING_INFO(); info.Flags = UnsafeNclNativeMethods.HttpApi.HTTP_FLAGS.NONE; info.RequestQueueHandle = IntPtr.Zero; IntPtr infoptr = new IntPtr(&info); uint statusCode = UnsafeNclNativeMethods.HttpApi.HttpSetUrlGroupProperty(_urlGroupId, UnsafeNclNativeMethods.HttpApi.HTTP_SERVER_PROPERTY.HttpServerBindingProperty, infoptr, (uint)BindingInfoSize); if (statusCode != UnsafeNclNativeMethods.ErrorCodes.ERROR_SUCCESS) { LogHelper.LogError(_logger, "DetachRequestQueueFromUrlGroup", "Result: " + statusCode); } }
private unsafe void AttachRequestQueueToUrlGroup() { // Set the association between request queue and url group. After this, requests for registered urls will // get delivered to this request queue. UnsafeNclNativeMethods.HttpApi.HTTP_BINDING_INFO info = new UnsafeNclNativeMethods.HttpApi.HTTP_BINDING_INFO(); info.Flags = UnsafeNclNativeMethods.HttpApi.HTTP_FLAGS.HTTP_PROPERTY_FLAG_PRESENT; info.RequestQueueHandle = DangerousGetHandle(); IntPtr infoptr = new IntPtr(&info); SetUrlGroupProperty(UnsafeNclNativeMethods.HttpApi.HTTP_SERVER_PROPERTY.HttpServerBindingProperty, infoptr, (uint)BindingInfoSize); }