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
The above solutions did not work for me and are not correct, since roslyn is not optional these days.
What worked was ensuring that the pool account had read & execute permissions on the root folder of the web application. You can find the account to grant this permission to by finding the Pool name your web app uses, then Application Pool -> pool name -> Advanced Settings -> Identity.
My VPS host uses non-standard directories for hosting as follows:
c:\home\web.app.name\wwwroot
The web.app.name folder needed the permission.
We encountered this due to a 3rd party application. MalwareBytes Anti-Ransomeware was actually the culprit that was blocking access. Resolved this with:
Updating the nuget package Microsoft.CodeDom.Providers.DotNetCompilerPlatform
to the latest version (at that time) 2.0.1
resolved this issue for me without having to grant permissions to the folder or remove the compiler.
If you need SmarterAsp.Net to allow the uploading of an .exe file to support the features and functionality of your website, you can. Just go to the control panel and turn on "Allow .Exe Files" See below:
In my case I had to do this because I wanted to host an Asp.Net Core website and that absolutely requires an .exe file :-)
Here's how I got it working:
In your Web.config
, set full trust (this will let you run them)
<configuration>
<system.web>
<trust level="Full" />
</system.web>
</configuration>
In your publish settings, enable "Precompile during publishing", but in the Advanced Precompile Settings (the Configure link next to this option), disable "Allow precompiled site to be updateable".
After hours of researching i came up with the solution.
Since the .NET 4.5 version, Roslyn compilation is the default way of compiling. This means if you create any web application either Web Forms or MVC using .NET 4.5 you get this Roslyn csc.exe compilation pre-installed in your project.
Basically what i needed was to compile and deploy my project without Roslyn or any .exe files on it.
So here is the Solution that worked for me. You can deploy without Roslyn with no change in code:
This will solve your purpose. Basically this will not generate any csc.exe, vbc.exe files inside bin folder.
I hope it works for you too!