I am using Microsoft Visual Studio 2015, I built a simple website with a C# contact form. When I compile and run on localhost it works perfectly fine. However, when I try to
Just experienced the same issue as the OP when publishing an ASP.net 4.5.2 SPA via web deploy in VS2015.
The solution I found to work was to remove the Nuget package "Microsoft.CodeDom.Providers.DotNetCompilerPlatform".
You could, alternatively, simply remove the system.codedom compiler config section from your Web.config file, which would have the same affect.
I had the same error and I solved it by enable the permissions of the hosting directory (read/write/delete).