Find all pairs of real numbers $a, b$ for which the equation in the domain of the real numbers
\[\frac{ax^2-24x+b}{x^2-1}=x\]
has two solutions and the sum of them equals $12$.
1. **Identify the domain and simplify the equation:**
   Given the equation:
   \[
   \frac{ax^2 - 24x + b}{x^2 - 1} = x
   \]
   We must have \( x \neq \pm 1 \) to avoid division by zero. Multiplying both sides by \( x^2 - 1 \) to clear the denominator, we get:
   \[
   ax^2 - 24x + b = x(x^2 - 1)
   \]
   Simplifying the right-hand side:
   \[
   ax^2 - 24x + b = x^3 - x
   \]
   Rearranging terms, we obtain:
   \[
   x^3 - ax^2 + 23x - b = 0
   \]

2. **Factorize the polynomial:**
   Since the equation has two solutions and their sum is 12, we assume the polynomial can be factored as:
   \[
   (x - p)^2 (x - (12 - p))
   \]
   for some real number \( p \neq \pm 1 \).

3. **Expand the factorized form:**
   Expanding the factorized form:
   \[
   (x - p)^2 (x - (12 - p)) = (x^2 - 2px + p^2)(x - (12 - p))
   \]
   \[
   = x^3 - (12 - p)x^2 - 2px^2 + 2p(12 - p)x + p^2x - p^2(12 - p)
   \]
   \[
   = x^3 - (12 - p + 2p)x^2 + (2p(12 - p) + p^2)x - p^2(12 - p)
   \]
   Simplifying the coefficients:
   \[
   = x^3 - (12 - p + 2p)x^2 + (24p - 2p^2 + p^2)x - 12p^2 + p^3
   \]
   \[
   = x^3 - (12 + p)x^2 + (24p - p^2)x - 12p^2 + p^3
   \]

4. **Equate coefficients:**
   Comparing the expanded polynomial with the original polynomial \( x^3 - ax^2 + 23x - b = 0 \), we get:
   \[
   a = 12 + p
   \]
   \[
   24p - p^2 = 23
   \]
   \[
   b = 12p^2 - p^3
   \]

5. **Solve for \( p \):**
   From the equation \( 24p - p^2 = 23 \):
   \[
   p^2 - 24p + 23 = 0
   \]
   Solving this quadratic equation using the quadratic formula \( p = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \):
   \[
   p = \frac{24 \pm \sqrt{24^2 - 4 \cdot 1 \cdot 23}}{2 \cdot 1}
   \]
   \[
   p = \frac{24 \pm \sqrt{576 - 92}}{2}
   \]
   \[
   p = \frac{24 \pm \sqrt{484}}{2}
   \]
   \[
   p = \frac{24 \pm 22}{2}
   \]
   \[
   p = 23 \quad \text{or} \quad p = 1
   \]

6. **Check for extraneous solutions:**
   Since \( p \neq \pm 1 \), we discard \( p = 1 \) and take \( p = 23 \).

7. **Find \( a \) and \( b \):**
   Using \( p = 23 \):
   \[
   a = 12 + p = 12 + 23 = 35
   \]
   \[
   b = 12p^2 - p^3 = 12 \cdot 23^2 - 23^3
   \]
   \[
   b = 12 \cdot 529 - 23 \cdot 529
   \]
   \[
   b = 529(12 - 23) = 529(-11) = -5819
   \]

Conclusion:
The only solution is \( (a, b) = (35, -5819) \).

The final answer is \( \boxed{ (35, -5819) } \).