If you don't need HTTP to be involved at all, you can simply run Razor engine from C# directly using RazorEngine
project - there is a great project that allows you to do so - https://github.com/Antaris/RazorEngine.
It allows you to use Razor as general purpose templating engine (rather than something MVC-specific).
Simple example from GitHub:
string template = "Hello @Model.Name, welcome to RazorEngine!";string result = Razor.Parse(template, new { Name = "World" });
Alternatively, if you still want that to be accessible via HTTP, you could do this relatively easy with ASP.NET Web API
, in a very lightweight manner - without having to worry about ASP.NET whatsoever (since you can even self host that).
WebApiContrib
has a Razor view formatter already available - https://github.com/WebApiContrib/WebApiContrib.Formatting.RazorViewEngine