[asp.net] Configuration Error: <compilation debug="true" targetFramework="4.0"> ASP.NET MVC3

I'm trying to deploy my website on somee.com but keeps getting this error

enter image description here

I've tried googling and it says I have to change my App Pool to ASP.NET 4.0. I've tried that already but with no luck:(

Informations:

-My site was coded in 4.0 Framework
-I'm using .NET Framework v4.0 Integrated
-I have checked needed things already in Windows Features
-Im using ASP.NET MVC3
-I already typed cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319 then aspnet_regiis -ir to cmd
-64 bit OS

This is the steps how I publish my site

  1. First I manually added this things to my Reference then changed the Copy Local to True

    Microsoft.Web.Infrastructure
    System.Web.Helpers
    System.Web.Mvc
    System.Web.Razor
    System.Web.WebPages
    System.Web.WebPages.Deployment
    System.Web.WebPages.Razor

  2. I Editted this on my Web Config

    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" targetFramework="4.0"/>
    <authentication mode="None"/>
    </system.web>
    </configuration>

  3. I add Deployable Dependencies that created _bin_deployableAssemblies which have this inside

    Microsoft.Web.Infrastructure.dll
    System.Web.Helpers.dll
    System.Web.Mvc.dll
    System.Web.Razor.dll
    System.Web.WebPages.dll
    System.Web.WebPages.Deployment.dll
    System.Web.WebPages.Razor.dll

  4. I then click Publish and have this settings

    This is how I Publish is this ok or I have to change something here? enter image description here

  5. I went to my IIS Manager. I right click on Default Web site Under Sites and choose Add Application with this settings enter image description here

  6. This resulted to this
    enter image description here enter image description here

  7. I went to C:/inetpub/wwwroot and sees this files
    enter image description here

  8. I then compressed it as zip then uploaded it in my account in somee.com then checked my site and now I'm getting the Configuration Error above.

    ABOVE IS MY UPDATED QUESTION I REPUBLISHED MY SITE AND INCLUDED STEPS HOW I PUBLISHED IT . I INCLUDED IT SO THAT YOU GUYS COULD SUGGEST IF I'M DOING SOMETHING WRONG ON HOW I'M PUBLISHING MY SITE AND COULD BE THE REASON OF THE ERROR ABOVE. THANKS IN ADVANCE :)


    My site works fine in the iis of the localhost of my machine it only gets that error when deployed on the internet. Btw I'm following the tutorials from these sites How to Deploy an ASP.NET MVC 3 App to Web Hosting with "\bin Deployment" Programming ASP.NET MVC 4 Chapter 19. Deployment Deployment ASP.NET MVC 3 project to IIS and somee

    Question: What could be the cause of this issue :( It's my first time to deploy a website on the internet. Hopefully you could help me guys.. If you need more info please tell me.

My IIS Manager enter image description here

My configuration enter image description here

or could this be the reason of my issue?

enter image description here


OK THIS PROBLEM WAS SOLVED. I FOUND OUT THERE'S NO PROBLEM ON MY SETTINGS. THE PROBLEM IS ON THE SETTINGS OF THE WEBHOSTING SITE. I CHANGED THE ASP.NET VERSION FROM 2.0 TO 4.0 BUT FORGOT TO CLICK THE UPDATE BUTTON :( I FEEL BAD I HAVEN'T REALIZED THAT. I'M NOW FACING ANOTHER ERROR BUT IT HAS NOTHING TO DO WITH THIS QUESTION. THANKS GUYS FOR TRYING TO HELP ME :)

This question is related to asp.net asp.net-mvc asp.net-mvc-3 razor

The answer is


I was now able to find reason behind the error guys. It's on the webhosting site settings not on my app pool or what so ever. I changed the asp.net version from 2.0 to 4.0 but I forgot to click the update button. I feel so embarrased. :( I've been struggling for days to fix this error and only to found out its on the webhosting site settings. GgrrRR.. As of now I'm facing new error but has nothing to do with this question. Anyway thanks guys for your efforts to help me. :)


How are you running the application? Are you just hitting the website or are you building and running from within Visual Studio? If you are building and running you may want to tell it to use the local IIS web server. This would make sure it is using the App Pool you have set up to run with v4.0/integrated.

I am guessing that it is using the Visual Studio Development Server when running. This server is probably trying to run with the 2.0 framework. This then causes your error to be thrown.

Edit: To note, I normally just build my website application and then I attach to process w3wp when I want to debug. I do not use the publishing tool. Of course this means my local working directory is within the web root.


This typically happens when you have an attribute of targetFramework="4.0" in the web.config but the App Pool is set to run ASP.NET 2.0. The targetFramework attribute is entirely unrecognized by ASP.NET 2.0 - so changing it to 2.0 won't have the desired effect.

Contact Support / Your Administrator and have the AppPool switched to 4.0.

You could also remove the attribute entirely, however if your site was coded with the 4.0 Framework, then I'm sure something else will cause an error as well.

Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive


If your application is 32 bit, and you want to deploy in a 64 bit machine, You need to set 'Enable 32 Bit Applications' property to 'True' in the application pool - advanced settings.


Try this, instead of selecting your websete's Application Pool to DefaultAppPool, select ASP.NET v4.0

Select your website in IIS => Basic Settings => Application Pool => Select ASP.NET v4.0

and you will be good to go. Hope it helps :)


Have you tried the aspnet_regiis tool to register .Net 4.0 for IIS? You can check more at msdn


My problem was solved that way:

Your username is probably restricted, You must grant full access to the user.

  1. Right Click on Project and select Properties
  2. Click on Tab Security
  3. Click Edit button
  4. Found Current User and Permission for User Allow Full Control

Each individual Web App under an IIS Web Site can use a different App Pool.

Verify the App Pool assigned to your app (not just the root site per your pictures) is .NET 4.0 compatible:

  1. Expand Default Web Site
  2. Right click on ProjectPALS, choose 'Manage Application' then 'Advanced...'
  3. Observe the 'Application Pool' your app is running as under the site
  4. Change to another App Pool if neccessary

You could be using the 32 bit version, so you should prob try at the command line from the Framework (not Framework64) folder.

IE Did you try it from C:\Windows\Microsoft.NET\Framework\v4.0.30319 rather than the 64 version? If you ref 32 bit libs you can be forced to 32 bit version (some other reasons as well if I recall)

Is your site a child of another site in IIS?

For more details on this (since it applies to various types of apps running on .NET) see Scott's post at:

32-bit and 64-bit confusion around x86 and x64 and the .NET Framework and CLR


Make sure that you are building your web app as "Any CPU". Right click your web project --> Properties --> Build --> and look for the "Platform Target". Choose "Any CPU" or play around with it.

Hope this helps!


Also try aspnet_regiis -u then aspnet_regiis -i on below path

C:\Windows\Microsoft.NET\Framework\v4.0.30319 

Now restart the IIS and check

Hope this will help !


Examples related to asp.net

RegisterStartupScript from code behind not working when Update Panel is used You must add a reference to assembly 'netstandard, Version=2.0.0.0 No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization How to use log4net in Asp.net core 2.0 Visual Studio 2017 error: Unable to start program, An operation is not legal in the current state How to create roles in ASP.NET Core and assign them to users? How to handle Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause() ASP.NET Core Web API Authentication Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0 WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery

Examples related to asp.net-mvc

Using Lato fonts in my css (@font-face) Better solution without exluding fields from Binding Vue.js get selected option on @change You must add a reference to assembly 'netstandard, Version=2.0.0.0 How to send json data in POST request using C# VS 2017 Metadata file '.dll could not be found The default XML namespace of the project must be the MSBuild XML namespace How to create roles in ASP.NET Core and assign them to users? The model item passed into the dictionary is of type .. but this dictionary requires a model item of type How to use npm with ASP.NET Core

Examples related to asp.net-mvc-3

Better solution without exluding fields from Binding IIs Error: Application Codebehind=“Global.asax.cs” Inherits=“nadeem.MvcApplication” Can we pass model as a parameter in RedirectToAction? return error message with actionResult Why is this error, 'Sequence contains no elements', happening? Failed to load resource: the server responded with a status of 500 (Internal Server Error) in Bind function 500.19 - Internal Server Error - The requested page cannot be accessed because the related configuration data for the page is invalid String MinLength and MaxLength validation don't work (asp.net mvc) How to set the value of a hidden field from a controller in mvc How to set a CheckBox by default Checked in ASP.Net MVC

Examples related to razor

Uncaught SyntaxError: Invalid or unexpected token How to pass a value to razor variable from javascript variable? error CS0103: The name ' ' does not exist in the current context how to set radio button checked in edit mode in MVC razor view @Html.DropDownListFor how to set default value Razor MVC Populating Javascript array with Model Array How to add "required" attribute to mvc razor viewmodel text input editor How to correctly use Html.ActionLink with ASP.NET MVC 4 Areas Multiple radio button groups in MVC 4 Razor How to hide a div element depending on Model value? MVC