The Asgard-Replicator war was a conflict which nearly saw the extinction of the Asgard up until the Tau'ri's appearance with the Tau'ri themselves ultimately winning the battle against the Replicators.
After discovering the Replicators on a planet in the Ida galaxy, the Replicators were quickly able to assimilate Asgard technology and become a serious threat to the Asgard. The Asgard responded by making more advanced technology, which the Replicators simply assimilated and became resistant to. For some time, the Asgard fleet, under the command of Supreme Commander Thor, was able to hold the Replicators off, and still use the few remaining resources to combat the Goa'uld. Eventually, however, the tide began to turn in the Replicators favor. (SG1: "Fair Game", "Nemesis")
The Asgard's alliance with the Tau'ri proved extremely beneficial to Asgard. Their guns were able to effectively terminate Replicator blocks, and their strategies were able to counter the Replicators. Major Samantha Carter's idea to use the O'Neill to lead three Replicators ships away from Othala and detonate the self-destruct was effective, a strategy the Asgard would admittedly never contemplate using. SG-1's discovery of the android Reese was able to further help the Asgard in combating the Replicators. However, the Replicators soon began to regain the advantage. (SG1: "Small Victories", "Menace", "Revelations")
Eventually, the Asgard High Council devised a bold trap: using a single command code in the deactivated Reese, they activated it on the planet Hala. The code instructed the Replicators to converge on Hala. There, they hailed Reese as their creator, and found her nanite cells held significant advantages over the standard Replicator blocks. However, this was only part of the Asgard's plan. They used a Time dilation device to slow down time within a radius of 0.16 light years by 10^4 power. Unfortunately, the Replicators were able to create a Human-form Replicator which was designated First. First was able to penetrate the device, made of Neutronium, and reverse it, making time go faster. SG-1 was contacted, and they were able to reset the device. (SG1: "Unnatural Selection")
The Asgard were aware that it would take the Replicators only two years outside the field to escape, so the Asgard artificially increased the mass of Hala's sun, causing it to collapse and become a black hole. However Fifth, the sole surviving Human-form Replicator, was able to use the Asgard time dilation device to counter act the effects of the black hole and escape the Asgard trap. Fifth then lead the Replicators to Orilla, where the Asgard were attempting to rebuild their civilization. Colonel Jack O'Neill, who had downloaded the Ancient's Repository of knowledge into his brain, devised a Replicator disruptor, which rendered their blocks and cells inert. Within a matter of months, the Replicators were forced to flee the Ida galaxy for a new location: the Milky Way. Eventually, a Replicator version of Lt. Colonel Samantha Carter was able to develop a cipher to make the Replicators immune, and killed Fifth, taking control of the Replicators. (SG1: "New Order, Part 1", "New Order, Part 2", "Gemini")
Upon learning of the power of the weapon on Dakara, Samantha and Jacob Carter were able to destroy every Replicator in the galaxy, ending their threat forever. In the battle, Dr. Daniel Jackson managed to get temporary control over the Replicators, turning the tide of the battle, but lost control and was killed. Replicator Carter was killed by the weapon as well. All of the Replicators had come to the Milky Way Galaxy for the invasion, so all were killed by the weapon. (SG1: "Reckoning, Part 1", "Reckoning, Part 2")