Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying ASP.NET MVC4 App to GoDaddy Compiler issue

Have seen several posts about deploying MVC apps to GoDaddy. None of them seem to address the issue we are having. We have followed the advice about checking runtime versions, IIS pipeline modes, publishing and copy local to true on assemblies so all works on GoDaddy.Com.

The issue we are having is that when we try to visit the site we get a Group Policy exception because ASP.NET runtime is trying to invoke the C# compiler.

[Win32Exception (0x80004005): This program is blocked by group policy. For more information, contact your system administrator]

[ExternalException (0x80004005): Cannot execute a program. The command being executed was "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe".........

We have gone through the publish settings and elected to precompile the site. That didn't fix the issue. Have looked at the site and there are no CS files deployed. The Global.asax file does reference a codebehind file. Since we precompiled the site we tried deleting the global.asax file and that doesn't fix the issue either.

Any thoughts would be great.

like image 655
Keith Franklin Avatar asked Jul 08 '14 17:07

Keith Franklin


3 Answers

I have struggled with the same problem for months. And finally solved it. In the plesk on godaddy I changed the ASP.Net settings. First changed CAS-trustlevel to Full. Then I changed in the Web.config of my project the following:

  • Add trust level full to the system.web
  • Remove the compilers in the system.codecom
 <system.web>
    compilation debug="true" targetFramework="4.5.2"/>
    <httpRuntime targetFramework="4.5.2"/>
    <trust level="Full"/>             <!-- Just add this to the webconfig -->
 </system.web>

 <system.codedom>
              <!-- All is removed between the 2 tags-->
 </system.codedom>

and that solved my problem.

like image 94
Neo1779 Avatar answered Nov 13 '22 18:11

Neo1779


You have to remove the compilation info from the web config and it will work.

In addition to precompiling (check the box in your publish settings), add the following to your Web.Release.config:

<system.web>
  <trust level="Full" xdt:Transform="Insert" />
</system.web>
<system.codedom xdt:Transform="Remove" /> <!-- No compiling on server, GoDaddy blocks it. -->

UPDATE (1/27/2017): It appears (at least on my account) that removing system.codedom is no longer required.

like image 22
Nick Kuznia Avatar answered Nov 13 '22 16:11

Nick Kuznia


I had same issue on GoDaddy hosting.

To fix it follow these steps.

Step 1: Choose "Precompile during publish" in Web Deploy settings.

Step 2: <trust level="Full" /> in <system.web> in Web.config

like image 9
Balpreet Patil Avatar answered Nov 13 '22 18:11

Balpreet Patil