Since I am not allowed weapons in my place of work I am courious about the affects of repeated exposure to extreme heat and cold on both the weapon and ammo.
Keep it clean and well-lubed. All should be well.
Ammo is self-contained. Though, the exterior surfaces can, over time, develop minor corrosion. But with defensive ammo we're unlikely to be keeping it around forever, particularly inside of a given gun. Rotate the ammo on a reasonably regular basis (something less than 1yr timeframe), and you shouldn't have any problems.
Firearms have metal parts, and not all metal bits in all guns are going to be treated against all environmental conditions equally well. So, just keep your gun clean and free of debris, well-lubed. Occasionally, do a "deep" clean, to get into all the little nooks and crevices, check the springs/bars and other little metal pieces that could, over time, develop little problems here and there. Imagine a gun that's being dunked in salt water frequently, then not cleaned nicely. In time, it'll begin to develop issues. Go after the gun occasionally as though it were that sort of thing, a gun that's been subject to such threats. Treated that way (albeit on a much longer timeframe, given that it's not salt water you're speaking of), it's hard to imagine a given gun's going to give up the ghost with any frequency.