8 For the real-coefficient quadratic equation $x^{2}+(a+1) x+a+b+1=0$ with two real roots $x_{1} 、 x_{2}$. If $0<x_{1}<1$ and $x_{2}>1$, then the range of $\frac{b}{a}$ is ( ).
(A) $\left(-2,-\frac{1}{2}\right)$
(B) $\left(-2, \frac{1}{2}\right)$
(C) $\left(-1,-\frac{1}{2}\right)$
(D) $\left(-1, \frac{1}{2}\right)$
8 Let $f(x)=x^{2}+(a+1) x+a+b+1$, then
$$
\left\{\begin{array} { l } 
{ 0  1 }
\end{array} \Leftrightarrow \left\{\begin{array} { l } 
{ f ( 0 ) > 0 , } \\
{ f ( 1 ) 0, \\
2 a+b+3<0 .
\end{array}\right.\right.\right.
$$

Draw the feasible region, the line $a+b+1=0$ and $2 a+b+$ $3=0$ intersect at point $A(-2,1)$. As shown in the figure, the feasible region for $(a, b)$ is the shaded area in the figure (excluding the boundary). $\frac{b}{a}$ is the slope of the line connecting the point $(a, b)$ in the feasible region to the origin, clearly it is less than the slope of line $O A$, which is $-\frac{1}{2}$, and greater than the slope of the line $2 a+b+3=0$, which is -2 (the range shown by the dashed line in the figure), i.e., $-2<\frac{b}{a}<-\frac{1}{2}$. Therefore, the answer is A.