One might justifiably say that the E part is in E major, and the C and D parts are in E minor. Or many other things. If you want to use just one key signature marking, it could be E major. Or it could be E minor.
If you make the E an E7 at least for awhile, it nicely flirts with the coming C - D part.
Which scales? Myself, I tend to think in terms of sets of chords and a tonal center, and scales come as a byproduct that's usually not worth thinking about much. But I'll try to speak guitarese now.
I feel that this chord progression has a gradient of tonal ambiguity possibilities for soloing. On the E major, you have the largest freedom in setting the "how many sharps are there now in the scale" slider.
On the E major chord : here you have the widest selection for scales, ranging from 4 sharps to 1 sharp.
- E major (4 sharps): if you want to say “this is not blues or rock”, outline an E maj 9 chord, after the chord progression's C - D part. Cheesy happy ending! Chords to outline: Diatonic chords from the E major key: E, F#m, G#m, A, B, C#m, D#dim. Or e.g. their sus4 or sus2 variations.
- E mixolydian (3 sharps) : flirts with the D major chord. Chords to outline: Diatonic chords from the A major key: E, F#m, G#dim, A, Bm, C#m, D. (And their sus4 or sus2 variations)
- E dorian (2 sharps) : does a blues/rock thing by playing a G on the chord's G#, while also keeping the door open for a D major with a C#. Chords to outline: Diatonic chords from the D major key: Em, F#m, G, A, Bm, C#dim, D. (And their sus4 or sus2 variations)
- E minor pentatonic or E blues ("1 sharp" ... F# that you know is there like it's in E minor, but you choose not to play it) : if you come in from the C - D part and want to keep repeating the same rebellious rock pattern while landing on the E major. Chords to outline: Em, G ... boring, you must break free from the scale to outline more chords.
- E mixolydian ♭6 (E, F#, G#, A, B, C, D) : bring in some A minor chord instead of the expected A major, while keeping E major as the tonic chord. This is a common trick in pop music. (The scale has the same notes as the A melodic minor.)
On the D major chord : slightly narrower palette at your disposal. From 3 sharps to 1 sharp. Pure E major interpretation with 4 sharps is not possible anymore, but interpretations towards fewer sharps are possible.
- E mixolydian (3 sharps) : after staying in E minor feelings in the C - D part, suggest that the E-based chord might actually be E major... reveal it by bringing in E mixolydian’s G#. Chords to outline: Diatonic chords from the A major key: E, F#m, G#dim, A, Bm, C#m, D.
- E dorian (2 sharps) : to move out from an E minor feeling, slightly before the E major chord comes in, bring in some E dorian’s C# note. "Oops, sorry, C major, you were a nice guy for awhile, but I'm so tempted by these other keys!" Chords to outline: Diatonic chords from the D major key: Em, F#m, G, A, Bm, C#dim, D.
- E blues, E minor pentatonic ("1 sharp", F# is there as a silent partner, and the added blue note, Bb) : "Rebellion! They say an E major chord is coming, but I'm a tough rock guy, I will never give in."
- E minor (1 sharp) : to make it clear that this D major is still good friends with the C major. "We will always stick together as good citizens of the E minor key, never flirt with E majors!" Chords to outline: Diatonic chords from the G major key: Em, F#dim, G, Am, Bm, C, D. And their sus4 or sus2 variations. Also try outlining a D9, D11 or D13 chord here.
On the C major chord : the narrowest selection of scales. 1 sharp. Think that you're in G major or E minor.
- E minor (1 sharp). Chords to outline: Diatonic chords from the G major key: Em, F#dim, G, Am, Bm, C, D. And their sus4 or sus2 variations.
- E blues, E minor pentatonic ("1 sharp" that you don't play)
What comes to chords to outline, you can of course do more complex and spread-out chords than the ones listed.
I didn't try listing diminished scales, because I feel the OP probably won't be playing them. The list of chords to outline would be interesting though.
I used this question as a pretext for making a video and a backing track, demonstrating what the various scales might sound like, and the idea that you can switch between scales in different ways. I'm not sure if it makes sense to anyone. I'm still strongly of the opinion that chords and individual notes should be the leading decision-making device when deciding what to play. Scales just result from the decisions. Chords rule, scales follow.
A subject for another question would be, how those scales and chords could be used when creating phrases, or how to emphasize the changed notes when switching between scales, etc.