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.
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.
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.
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
I removed the Roslyn nuget package like explained in the link below, but it's a workarround.
https://social.msdn.microsoft.com/Forums/en-US/442b100a-2b88-4ac4-b655-0c1345791f15/roslyn-cscexe-web-api-2-on-hosting-server?forum=msbuild
This problem happens with a clean mvc 5 web project from visual studio 2015 template.
I contacted the godaddy support, let's see what they do.
Excellent. I also have same problem. However, my hosting vendor is arvixe.
Add >trust level="Full" />" under >system.web> section in Web.config
comment out >compilers> section of the >codedom> in Web.config
The problem Fixed!!!
csc.exe compiler error after publish
comment below on web.config
<!--<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:6 /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:14 /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>-->
Related
I'm trying to build an ASP.NET web site for Microsoft .NET 4.0 using Entity Framework 6. The website is explicitly targetting .NET 4.0 in web.config:
<compilation debug="true" targetFramework="4.0">
, IIS Express' application pool in applicationhost.config also targets .NET 4.0:
<add name="Clr4ClassicAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
When the site is launched, a number of CS0433 compiler errors is shown, ones like below:
error CS0433: The type "System.ComponentModel.DataAnnotations.Schema.TableAttribute" exists in both "c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" and "c:\Users\%username%\AppData\Local\Temp\Temporary ASP.NET Files\vs\e798ee36\2b3f5a24\assembly\dl3\fd34a92a\0052703a_0990d101\EntityFramework.DLL"
As far as I remember, there should be no System.ComponentModel.DataAnnotations assembly in .NET 4.0, or at the very least it shouldn't contain classes like TableAttribute, KeyAttribute etc. The only lead I have is the bottom line of error page, which says
Microsoft .NET Framework, version:4.0.30319; ASP.NET, version:4.6.1055.0
however, I don't know how to change specifically ASP.NET version for a website (of course, if that's the problem's source).
Have you tried setting the compilation batch to false?
<compilation debug="false" batch="false">
I'm assuming you've got code in your App_Code folder (likely your Entity Framework classes at the least?).
Now you could move your code out of there, and precompile everything so that you deploy the website assembly and not any source files.
Otherwise, you really need to look at your projects and ensure that nothing is referencing System.ComponentModel.DataAnnotations.
Also, check any web.config in the project at the root, or in the App_Code folder(s) and make sure there is no
<add assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
under system.web/compilation/assemblies. If there isn't, you could even try putting in
<remove assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
e.g.:
<compilation>
<assemblies>
<remove assembly="System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</assemblies>
</compilation>
You can also check to make sure it's running the earlier version of ASP.NET so that it picks up the version of the DataAnnotations assembly that doesn't have the Schema attribute (as the 4.5+ framework version does):
<configuration>
<system.web>
<httpRuntime targetFramework="4.0" />
</system.web>
</configuration>
Hey Can you check your project.Please check there should not be two model with same properties.Model can also be entity framework class model
Check if all NuGet packages for your project are updated or if there are any installed that you don't want.
I do not understand from where this problem comes. I have the correct assembly in the Bin, the same is correctly referenced in the web.config
<compilation targetFramework="4.5" debug="true">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="Telerik.ReportViewer.WebForms, Version=8.1.14.804, Culture=neutral, PublicKeyToken=A9D7983DFCC261BE"/>
</assemblies>
</compilation>
....
<httpHandlers>
.........
<add path="Telerik.ReportViewer.axd" verb="*" type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=8.1.14.804, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" validate="true"/>
</httpHandlers>
the particular feature object of the error is working on my developing machine but on the production server I get this error!
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load file or assembly 'Telerik.Reporting, Version=8.1.14.804, Culture=neutral, PublicKeyToken=a9d7983dfcc261be' or one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source Error:
Line%70<td%class="leftGridColumn"> </td>
Line%71:<td%class="centerGridColumn">
Line%72<telerik:ReportViewer%ID="ReportViewer1"%runat="server"%Width="100%"%Height="660px"%ShowExportGroup="False"%
Line%73:</td>
Line%74:<td%class="rightGridColumn"> </td>
Any hint will be really appreciated I do not know what else do do to solve this problem.
The only thing I can think of is 'Are you sure you are using the correct/compatible version of the .Net Framework?'. I had a problem a while back when using Asp.Net MVC where it didn't like 4.5, so i had to create a 4.0 project.
EDIT
Just found this on an old blog:
The original warning you receive explains that you should register the handler for the web report viewer in the httphandlers section in the web config. However if you're hosting the application in IIS7, there is a different section to add the handler to, namely the <system.webServer>\<handlers> section:
<system.webServer>
<handlers>
<add name="Telerik.ReportViewer.axd_*" path="Telerik.ReportViewer.axd" verb="*" type="Telerik.ReportViewer.WebForms.HttpHandler, Telerik.ReportViewer.WebForms, Version=3.2.9.1211, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" preCondition="integratedMode,runtimeVersionv2.0" />
</handlers>
<validation validateIntegratedModeConfiguration="false" />
</system.webServer>
"it clearly states that it cannot find a necessary assembly you're referencing. During the installation of Telerik Reporting on your machine, the Telerik assemblies were added to GAC. When deploying a Web Site project the assemblies from the GAC are not copied automatically, so you need to copy the assemblies manually from the installation’s Telerik Reporting /bin folder to the bin folder of your application on the server. Full step by step instructions on deploying are included in the Deploying Applications using Telerik Reporting help article."
Here's the link: http://www.telerik.com/forums/web-reportviewer-error
I am getting the error:
HTTP Error 500.21 - Internal Server Error
Handler "CloudConnectHandler" has a bad module "ManagedPipelineHandler" in its module list
my web.config file looks like this:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="CloudConnectHandler" verb="*" path="CloudConnect.aspx" type="CloudConnectHandler" resourceType="Unspecified" />
</handlers>
</system.webServer>
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.0" batch="false">
<assemblies>
<add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="Microsoft.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
</assemblies>
</compilation>
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
<identity impersonate="true" />
<authentication mode="Forms" />
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v4.0" />
<providerOption name="WarnAsError" value="false" />
</compiler>
</compilers>
</system.codedom>
<appSettings>
<add key="CloudConnectAuthorization" value="xxxx" />
<add key="ConnectionInfo" value="xxxx" />
<add key="ConnectionString" value="xxxx" />
<add key="DefaultChannel" value="xxxx" />
<add key="LoginValidationConnectionString" value="xxxx" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="protobuf-net" publicKeyToken="257b51d87d2e4d67" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.640" newVersion="2.0.0.640" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
There is a lot of advice out there indicating that asp.net is not installed correctly. The usual fix is to run:
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
or
%windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe -i
I have run both, without any errors. I have restarted IIS, but the problem still persists. The site is using an application pool. The app pool is started, .net framework = 4.0, Managed Pipeline = Classic, Identity = LocalSystem.
I've spent the last couple hours trying to figure out what the problem is. I'm hoping someone can help.
Please follow these steps:
1) Run the command prompt as administrator.
2) Type either of the two lines below in the command prompt:
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
or
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
I ran into this error on a fresh build of Windows Server 2012 R2. IIS and .NET 4.5 had been installed, but the ASP.NET Server Role (version 4.5 in my case) had not been added. Make sure that the version of ASP.NET you need has been added/installed like ASP.NET 4.5 is in this screenshot.
To fix the problem, I tried to run
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
However It didn't work for me. I have to run another command line in CMD window as administrator. Here is the command:
dism /online /enable-feature /featurename:IIS-ASPNET45
or
dism /online /enable-feature /featurename:IIS-ASPNET45 /all
Hope it will help.
Try switching to Integrated mode. See the following thread:
IIS 7, HttpHandler and HTTP Error 500.21
I got this error on my ASP.Net 4.5 app on Windows Server 2012 R2.
Go to start menu -> "Turn windows features on or off". A wizard popped up for me.
Click Next to Server Roles
I had to check these to get this to work, located under Web Server IIS->Web Server-> Application Development (these are based on Jeremy Cook's answer above):
Then click next to Features and make sure the following is checked:
Then click next and Install. At this point, the error went away for me. Good luck!
This is because IIS 7 uses http handlers from both <system.web><httpHandlers> and <system.webServer><handlers>. if you need CloudConnectHandler in your application, you should add <httpHandlers> section with this handler to the <system.web>:
<httpHandlers>
<add verb="*" path="CloudConnect.aspx" type="CloudConnectHandler" />
</httpHandlers>
and also add preCondition attribute to the handler in <system.webServer>:
<handlers>
<add name="CloudConnectHandler" verb="*" path="CloudConnect.aspx" type="CloudConnectHandler" preCondition="integratedMode" />
</handlers>
Hope it helps
I had this issue in Windows 10 when I needed IIS instead of IIS Express. New Web Project failed with OP's error. Fix was
Control Panel > Turn Windows Features on or off > Internet Information Services > World Wide Web Services > Application Development Features
tick ASP.NET 4.7 (in my case)
For me, I was getting this error message when using PUT or DELETE to WebAPI. I also tried re-registering .NET Framework as suggested but to no avail.
I was able to fix this by disabling WebDAV for my individual application pool, this stopped the 'bad module' error when using PUT or DELETE.
Disable WebDAV for Individual App Pool:
Click the affected application pool
Find WebDAV Authoring Tools in the list
Click to open it
Click Disable WebDAV in the top right.
This link is where I found the instructions but it's not very clear.
I had this problem every time I deployed a new website or updated an existing one using MSDeploy.
I was able to fix this by unloading the app domain using MSDeploy with the following syntax:
msdeploy.exe -verb:sync -source:recycleApp -dest:recycleApp="Default Web Site/myAppName",recycleMode=UnloadAppDomain
You can also stop, start, or recycle the application pool - more details here: http://technet.microsoft.com/en-us/library/ee522997%28v=ws.10%29.aspx
While Armaan's solution helped get me unstuck, it did not make the problem go away permanently.
if it is IIS 8 go to control panel, turn windows features on/off and enable Bad "Named pipe activation" then restart IIS. Hope the same works with IIS 7
I discovered that the order of adding roles and features is important.
On a fresh system I activate the role "application server" and there check explicitly .net, web server support and finally process activation service
Then automatically a dialogue comes up that the role "Web server" needs to be added also.
Install .NET framework as below, it will work .NET version 4.5 as well.
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir
Some time only give aspnet_regiis.exe -i don't work so give aspnet_regiis.exe -ir in above path.
I've run into a problem with WCF REST Service. I get:
Could not load type 'System.ServiceModel.Activation.HttpHandler' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
when running inside of the IIS in an ASP.NET 4.0 AppPool.
The problem seems to occur only if:
Running inside of IIS
When ASP.NET Comaptibility is enabled
Running in Cassini - no problem it works properly. Running with ASP.NET compatibility off - no problem it works.
It appears that it's some sort of handler version conflict trying to instantiate the wrong version of the handler that in turn tries to load an older version of System.ServiceModel, but I haven't been able to trace this down.
Anybody seen anything like this before and have any ideas how to track this down further?
I've looked in ApplicationHost.config and the master web.config files for System.ServiceModel and HttpHandler references but no luck. There.
+++ Rick ---
fire up your Visual Studio 2010 Command Prompt or browse to "C:\Windows\Microsoft.NET\Framework\ v4.0.30319". And run the following command from the command prompt:
aspnet_regiis.exe -iru
This will register latest .net version. Also make sure your app pool is running latest version of .net
So as expected this turned out to be a versioning conflict in the default handler mappings in ApplicationHost.config. Specifically IIS has mappings for ASP.NET 2.0 and ASP.NET 4.0 specific references to the service activation handler (and module) and the 2.0 references weren't restricted by a version specific preCondition.
To fix the above problem I had to change (at the System root in ApplicationHost.config):
<add name="svc-Integrated" path="*.svc" verb="*"
type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
preCondition="integratedMode" />
to:
<add name="svc-Integrated" path="*.svc" verb="*"
type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089"
preCondition="integratedMode,runtimeVersionv2.0" />
Note the EXPLICIT runtimeVersion2.0. There are additional *.svc maps in the same section for the runtimeVersion4.0 which then fire the appropriate runtimes.
According to Microsoft this situation can arise when some older tools (I'm guessing Azure tools???) are installed that don't register the runtime version properly.
Problem solved.
There is one more way if all of above doesn't work. (Strange)
We were using Windows Server 2008 R2 SP1 with IIS 7.5.7600
After registering latest framework as given in above answer,
You need to the add handler mapping to v.4.0 assembly manually to web.config and remove "ServiceModel" from Modules.
<system.webServer>
<handlers>
<remove name="svc-Integrated" />
<add name=".svc" verb="*" path="*.svc" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory,
System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</handlers>
<modules>
<remove name="ServiceModel" />
</modules>
</system.webServer>
More here
I have numerous ASP.NET 3.5 web applications with verbose application-level web.config files which I wish to slim down and make more readable.
Visual Studio 2010 has just arrived and has already started "cleaning up" various sections of the web.config - so now is a perfect time for me to continue the good work and do the same in other areas of the web.config file.
Currently I have several third party assemblies all happily registered in the GAC, these are then referenced in each application-level Web.Config see below;
<configuration>
<system.web>
<compilation defaultLanguage="C#" debug="true">
<assemblies>
<add assembly="AjaxControlToolkit, Version=3.0.30512.20315, Culture=neutral, PublicKeyToken=28F01B0E84B6D53E"/>
<add assembly="aspNetEmail, Version=3.5.2.0, Culture=neutral, PublicKeyToken=BC571E8DA1C1F543"/>
<add assembly="aspNetDns, Version=3.0.0.0, Culture=neutral, PublicKeyToken=BC571E8DA1C1F543"/>
<add assembly="Microsoft.Practices.EnterpriseLibrary.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="Microsoft.Practices.EnterpriseLibrary.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</assemblies>
</compilation>
</system.web>
</configuration>
I have moved the above compilation-node into the global web.config file located at Windows\Microsoft.NET\Framework64\v4.0.30319\Config\web.config - and the application runs just fine under IIS7 i.e. the application has no trouble finding these GAC'd assemblies.
however when I now compile (shift+ctrl+b) my web application in visual studio 2k8 or 2k10 I'm getting the familiar error "The type or namespace name 'aspNetDns' could not be found (are you missing a using directive or an assembly reference?)"
What do I have to do to get visual studio to recognise the whereabouts of these GAC'd libraries? I tried copying them into windows\system32 but no joy there...
help! :)
NB: I have also tried working with the machine.config but still no luck
Solved it.
I needed to edit the global web.config in the x86 directory (as well as the x64 version) - the x86 version is obviously the one Visual Studio was looking at whilst compiling the app, whereas IIS was looking at the x64 version of the global web.config when running the app.
Drag / drop the assemblies to c:\windows\assembly on your local machine where you are recompiling.