Stochastic quantization of field theory in finite and infinite volume