By Chern-Weil theory, $c_1(L)=\frac{i}{2\pi}[F_A]$ for any $U(1)$-connection $A$. For an ASD connection ($\ast F_A=-F_A$) we have $$c_1(L)^2=\frac{-1}{4\pi^2}\int_M F_A\wedge F_A=\frac{1}{4\pi^2}\int_M F_A\wedge \ast F_A\equiv-\frac{1}{4\pi^2}||F_A||^2\le0$$ So $c_1(L)^2>0$ is an obstruction. Exercise: Find such an $L$ on $M=S^2\times S^2$.

On the other hand, the trivial connection on the trivial bundle is ASD.


For an "iff" statement, read sections 1.1.6 and 4.3.3 of Donaldson-Kronheimer's book (*The geometry of four-manifolds*). Although they talk about ASD connections on $SU(2)$ bundles, you can consider *reducible* $SU(2)$ connections which correspond to what we care about on $U(1)$ bundles. What we observe is:  
1) We really care about cohomology thanks to Hodge-deRham theory, noting that ASD connections have harmonic curvature.  
**2) Main point:** Given a metric $g$, we have projections $\pi_\pm:H^2(X;\mathbb R)\to H^2_\pm(X;\mathbb R)$ and the condition for $L$ to admit an ASD connection is that $\pi_+(c_1(L))=0$.  
**3) Remark:** If $b^2_+(X)>0$ then for generic $g$ we have $\pi_+$ nonvanishing on the lattice $H^2(X;\mathbb Z)$ (which contains $c_1(L)$), because the codimension of $H^2_-(X;\mathbb R)$ is $b^2_+(X)$ and the dimension of the lattice is 0. So we won't have nontrivial line bundles with ASD connections for generic metrics.