Well Known Host Meta file in ASP MVC

To server a host-meta file in the .well-known folder from an ASP MVC application hosted in IIS, the easiest way is probably saving your host-meta file in a folder then adding a route and action for it.

So this would be your route in Global.asax

routes.MapRoute("HostMeta", ".well-known/host-meta", new {controller = "WellKnown", action = "HostMeta"});

and here is the new controller to serve it:

    public class WellKnownController : Controller
    {
        public ActionResult HostMeta()
        {
            string result = System.IO.File.ReadAllText(Request.MapPath("~/somewhere-on-the-server/host-meta"));

            return Content(result);
        }
    }