First off, $ax^2+bx$ is a quadratic, and the domain of $f$ is the region where the quadratic is non-negative. If this set includes any negative numbers, it's game over: $f(x)$ can never be negative, so the range won't match the domain.
Therefore, $ax^2 + bx < 0$ when $x < 0$. It immediately follows that $a$ is negative or zero.
If $a$ is zero, we win: setting $b=1$ (or your favorite positive number) works. So $a=0$ is one solution to the problem.
Otherwise, $a$ is negative. Solving the quadratic, the solutions are $0$ and $-b/a$, so the domain of $f$ is $[0, -b/a]$. This has to include only positive numbers, so b must be positive. Now, the quadratic ranges from $f(0)$ to its maximum $f(-b/2a)$, since $-b/2a$ is right between the zeroes, so the range of the function $f$ is
$[0, b\sqrt{-1/4a}]$.
Therefore, since the range and domain are equal, $-b/a = b\sqrt{-1/4a} \rightarrow -1/a = \sqrt{-1/4a}$, and the unique solution of this latter equation is $a=-4$.
In summary, there are two solutions, $a=0$ and $a=-4$.