On August 1, 1891, he was commissioned Second Lieutenant in the United States Army and assigned to the Fourth Infantry for duty. He was subsequently promoted as follows: First Lieutenant, Fourth Infantry, April 28, 1898; Captain, Squadron Philippine Cavalry, April 23, 1900; Captain, Fourth Infantry, February 2, 1901; Major, Twenty-first Infantry, August 27, 1913; Lieutenant Colonel, Sixth Infantry, May 13, 1917; Colonel, Thirty-eighth Infantry, August 5, 1917; Brigadier General, Ninth Brigade, April 12, 1918. He attended the Infantry and Cavalry School in 1895, and was in the War College in 1915. Prior to World War I, Castner had already distinguished himself. While a Lieutenant, he participated as an explorer in the Glenn Expedition in Alaska. In the Philippines, for his services with the Tagalog Scouts, he was promoted to a Captaincy in the Philippine Squadron of Cavalry, which commission he held until receiving a captaincy in the Regular Army. Later, he served as Constructing Quartermaster in both Honolulu and in Yellowstone National Park. While yet a Captain, he commanded the Second Battalion, Fourteenth Infantry, and under his training that battalion made an unequaled record in known distance firing. While a Major, he was Adjutant General of the District of Columbia Army National Guard, which he developed to a high state of efficiency. As Colonel of the Thirty-eighth Infantry, he instilled that fighting spirit which won for that regiment its fame as the "Rock of the Marne." As Brigadier General, he took command of the Ninth Infantry Brigade. In the quiet Anould and St. Die sectors, he gave the units of the Brigade effective training for the big operations that were to follow. In the Battle of Saint-Mihiel, General Castner's brigade was at first in reserve with the Tenth Brigade in line. When passage of lines was made, he pushed his outpost lines up near to the Hindenburg Line. In the first phase of the Meuse-Argonne Offensive, his Brigade captured Cunel and drove the enemy from the Bois-de-la-Pultiere and the northwestern Bois-de-Foret. In the second phase of the Meuse-Argonne Offensive, Castner's Brigade captured Aincreville, Clery-le-Grand, Clery-le-Petit, Bois de Babiemont, the Punchbowl and Doulcon. Then the Brigade forced the difficult crossing of the river Meuse and fighting northward captured in succession Dun-sur-Meuse, Milly-devant-Dun, Lion-devant-Dun, Cote St. Germain, Château de Charmois, Mouzay, and the Foret de Woevre. In appreciation for his services in the Meuse-Argonne Operation, Castner was awarded the Distinguished Service Medal. He was cited in Fifth Division Orders. While his brigade formed part of the Army of Occupation, Castner took the course of instruction at the Army Center of Artillery Studies at Trier, Germany. Castner retired while commanding Third Division in the Western States.