The writ may be served as follows, except where different directions respecting the mode of service thereof are given by the court granting it:
(1) Where it is directed to a person or persons by name or by his or her official title or titles, or to a municipal corporation, it must be served upon each officer or other person to whom it is directed, or upon the corporation, in the same manner as a summons.
(2) Where it is directed to a court, or to the judges of a court, having a clerk appointed pursuant to law, service upon the court or the judges thereof may be made by filing the writ with the clerk.