Why is the introduction of a quantization volume necessary for quantization of the EM field I have been working through the quantization of the electromagnetic field, and every source I find introduces a quantization volume with periodic boundary conditions in the process, in which we fit the general solution of $A(\boldsymbol{x},t)$. Why is this necessary? I understand that this allows us to consider a countably infinite sum over wave vectors, rather than an uncountable one, as the wave vectors are made to satisfy the periodic boundary conditions.
I have the vague impression that it has something to do with the orthogonality of the wave functions (solutions to the wave equation of the field before quantization), so that integration as follows yields a delta function
$$\sum\limits_{kk'} \int dx \, e^{i(k-k')x} = \delta(k-k')$$
but then I think this should work equally in the continuous case
$$\int\int {dk \,dk'} \int dx \, e^{i(k-k')x} = \delta(k-k')$$
What am I not understanding? Thanks in advance for any help!
 A: Quantizing in a finite volume is not specific to the electromagnetic field, and it is not a necessity, neither for the electromagnetic field nor for any other.
It is generally more well-behaved to quantize in a finite volume because no infrared-like divergences appear from allowing arbitrarily low momenta (since no arbitrarily long wavelengths fit into the finite volume), and because extensive quantities like energy will not turn out to be infinite, while, naturally, e.g. for non-zero (vacuum) energy density and infinite volume the (vacuum) energy will also be infinite.
But you may also quantize in infinite volume and have Fourier integrals over momenta instead of Fourier sums, there is nothing prohibiting it, and "usually" (i.e. in my limited experience) QFT is indeed done in infinite volume.
A: One reason for the box is the Fourier expansion of field in stable macroscopic condition  (thermal radiation, cavity oscillations) works well only for finite volume. For infinite volume, the Fourier integral of such stationary field is problematic, because the field function is not L2 integrable.
