There is a technology called Roslyn
] that exposes the compiler as a service. You can probably exposed a web service as a facade onto this, but your actual requirements are unclear.
I haven't used it, it look like you need VS2012 and it is in CTP (i.e. it's not even Beta yet) but hopefully this is something useful for you to look into.