How is Casimir effect related to String theory?

I'm looking at the Casimir effect calculation. As I understand it, it says that because wavelengths can only take on discrete values between two sheets there is a difference in the energy of the vacuum. Because in a vacuum the wavelengths can take on any value. Hence it is the difference between the sum and the integral.

$$E \propto \int\limits_0^\infty{x^3}dx - \sum_{x=1}^\infty x^3 \\ = \lim_{\alpha\rightarrow 0^+} \left(\int\limits_0^\infty{x^3}e^{-\alpha x} dx - \sum_{x=1}^\infty x^3e^{-\alpha x}\right)\\ = \frac{1}{120}$$

using regularisation.

In Bosonic string theory there is also the sum $\sum n$ where we add up all the modes of the string. But in this case what are we substracting? With analogy to the Casimir calculation it seems like we are comparing it to a slice of an infinite string which can take on any modes which would give an integral. What does this mean?

My interpretation is that in the absence of D-branes the vacuum can have infinite length strings. And that with a pair of D-branes (like the Casimir planes) an open string has a discrete modes of vibration. But this interpretation breaks down when we think of closed strings. What is the interpretation?

In quantizing a bosonic string using old covariant quantization scheme, the sum $\sum n$ which you mention comes about when you impose Gauss law on the state space using Virasoro generators. Recall that the energy momentum components $T_{++}$ and $T_{--}$ for a bosonic string should vanish classically. Upon quantization, when we impose the same on the state space, and use the Fourier decomposition of the energy momentum components, then this reduces to

$$L_n |\psi>= 0,$$ for n being a positive integer and

$$(L_0 - a) | \psi> = 0,$$

where $L_m$'s are the Fourier modes of the components . The precise form of $L_n$ is given by:

$$L_n = \dfrac{1}{2}\sum_{n'} \alpha_{n-n'}\alpha_{n'}.$$

You can immediately notice in the above expression that $L_0$ has an ordering ambiguity, since the $\alpha's$ are operators upon quantization. Here $L_0$ is explicitly given by:

$$L_0 = \dfrac{1}{2}\alpha_0^2 + \sum_{n} n.$$

This is why we can't directly impose $L_0 |\psi> = 0$ on the state space. As you can see because of the normal ordering ambiguity we now have to subtract a constant in the equation for $L_0$. A similar thing happens in the calculation of Casimir effect in standard QFT also.