There are variations of views, but generally, if you are in uniform, you are on duty. Remember, you get paid 24/7, and you are never technically, completely off duty if you are being paid.
Military personel do not have the same legal rights as civilians. There is no constitutional rights issue at work here.
While there may not be a regulation specifically prohibiting it, generally you can only be armed when it is part of your official duty. And then, only with what is issued to you by the service.
Some commands allow a bit of leeway, others do not. Commands with troops in combat are, historically, more tolerant about many things than those in the rear.
But that is on the local commanders authority, not the general regulations.
Packing your personal pistol CCW under your uniform? Article 15, or worse, if caught, I would think.