The US Military has a long history of helping filmmakers whenever they're making movies that portray the US Military in a good light. They have helped multiple productions, not just in a consulting role, but also providing soldiers as extras, and letting filmmakers shoot on military bases.
So, it was kinda surprising that they pulled out of consulting for The Avengers. The reason they gave was that the movie was too unrealistic. You might think that they were talking about the ridiculous spandex costumes or the alien invaders. You'd be wrong. The reason the movie was too unrealistic was because of S.H.I.E.L.D., the military organization that gathers and directs The Avengers.
What they were concerned about was much more simple than the technology. It was the chain of command. It's not entirely clear who S.H.I.E.L.D. responds too, who's in charge of S.H.I.E.L.D. This is what the Hollywood liaison for the military said: To whom did SHIELD answer? Did we work for SHIELD? It just got to the point where it didn't make any sense. We hit that roadblock and decided we couldn't do anything [with the film]."
So there you have it, if you want to make a film with the aid of the US Military you should make it really clear who's really calling the shots in the military.