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

I just installed vs 2010, followed by IIS in window 7. when building a website in .net framework 4.0 and convert this into application in IIS then its shows this error
If i remove the targetFramework="4.0" from web config file then it shows me a second error which is related to linq reference error
This all happening when i am using localhost to run my website but whenever i use just f5 in vs 2010 then its run perfectly.
When i want to attach my process with aspnet_wp.exe i don't find this process in my list.
I searched a lot of answers here. What am I missing.

The problem could be:
the Application Pool for your site is configured for .NET Framework Version = v2.0.XXXXX
.NET 4 isn't installed on your server.
See also
Unrecognized attribute 'targetFramework' ...
How to add ASP.NET 4.0 ...
... which helped me fix a similar issue.

You'll likely need to re-register ASP.Net version 4 with IIS.
Navigate to your .net framework 4.0 folder, and run aspnet_regiis.exe -i
For example, my .net framework 4.0 folder (Server 2k8 R2 x64) was located at:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319

From Control Panel open IIS manager -> on Left side select "Application Pools" -> Now on middle part your project listing display then select your project e.g. "MvcApplication1" -> from right side select "set Application Pool Defaults" -> Now change .Net Framework Version from V2.0 to V4.0
This one is work for me but make sure you have already installed .Net Framework 4.0 .

Run the following command to fix this problem.
Start --> Run:
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe –i
If you get an error about ADMIN rights you need to do the following.
1. CTRL+SHIFT+ENTER from the RUN menu will run as ADMIN
2. START --> PROGRAMS --> ACCESSORIES --> Right-click on command prompt and "run as administrator"

You can also open your projects property pages in VS, and in "Build" section choose as "Target Framework" - .NET Framework 4. It helped me with the same issue.

Open your IIS, click on your application pool and change the settings there. Click the defaultAppPool and check the .Net Clear version if version 4.0 is present. you can perhaps change the pipeline mode to integrated.

Your current .Net Framework version 2.0.
.Net Framework Version 4.0(or more than 4.0) is not installed on your server.
Update your .Net Framework Version. If not solved yet, you have to change your IIS .Net Framework Version settings and select the .Net Framework Version 4.0.

Related

"Unrecognized attribute 'secure'. Note that attribute names are case-sensitive." when running website on IIS

I am having a problem with configuring my ASP.NET project on IIS. I have exactly 2 same servers (I mean same IIS settings everything) created from the same image. However, one is working fine, while for the other one, I am facing the problem "Unrecognized attribute 'secure'. Note that attribute names are case-sensitive." (pls see the screenshot below)
Does anyone know what might be the root cause of this and how to resolve it? Thank you.
This error is usually caused by an incorrect .net version, you can try follow steps:
Check on which .NET version the application is developed. Let's assume, it's .NET 4.0.
Open IIS Manager and find the Application Pool, on which your website is hosted.
Go to that Application Pool and check the .NET version and change it to 4.0 accordingly by clicking on Basic and Advanced Settings.
If .NET 4.0 is not listed, go ahead and install it.
If it still won't show up, go to command prompt and fire the below command to find a list of ASP.NET versions installed: C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -lv
In the output, if .NET 4.0 is not listed, register it by firing the below command: C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis.exe -I.
It should show up as .NET 4.0 in the .NET Framework Version dropdown for the application pool.

how to configure asp.net with .net 4.5

I am using visual studio 2012 ultimate. Every time I open asp.net web form application the following message pops up.
Configuring web http://"localhost":35651/ for ASP.NET 4.5 failed.
You must manually configure this site for ASP.NET 4.5 in order for the site to run correctly. ASP.NET 4.5 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.5 in order for you site to run correctly.
How to get rid of this message ?
You can install this update and your problem should be solved:
MSDN link
Update:
I've uploaded the file to my Dropbox account so that people can have alternative URL in case if the first one fails, The File Name is VS11-KB3002339.exe
I had this problem on Windows 8.1 and Windows 10 which wouldn't support the aspnet_regiis -i approach.
Go to Control Panel, Click On Programs locate the "Turn Windows features on or off" option Under Programs and Features and drill down as follows:
Internet Information Services -> World Wide Web Services -> Application Development Features and check the "ASP.NET 4.5" option. In checking this box, other options such as ".NET Extensibility 4.5" and the ISAPI options will be checked automatically.
Apply the changes by clicking OK. Restart your System.
Use aspnet_regiis.exe -i. Only you need to set the path of .net version. See this link for more information
ASP.NET 4.5 has not been registered on the Web server
FOR VISUAL STUDIO 2012
you actually need to download an update to fix it from here:
https://support.microsoft.com/en-us/kb/3002339
Description:
Unexpected dialog box appears when you open projects in Visual Studio 2012 after you install the .NET Framework 4.5.3
Reference from related thread.
https://stackoverflow.com/a/49746751/3261852

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

I'm trying to up load my site and I'm getting this error message:
Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
<compilation debug="true" targetFramework="4.0">
The site works fine on my local PC but won't open when I loaded it to my host and tried to view it online.
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.
Registering the framework with IIS is what worked for me:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
In IIS
Click on Application Pools
Right Click on DefaultAppPool --->> Set Application Pool Default....--->>Change .Net Version to V 4.0.
open your IIS (type inetmgr in run) and change your Application pool setting,To view large this Image Right Click Image and open image in new tab
In Visual Studio menu:
Website -> Start Options -> build tab -> Select Target Framework in
Dropdown box (.NET FrameWork 4)
I was facing the same issue while publishing my 1'st web services. I resolved it by simply doing this:
Open IIS
Click on Application Pools
Right Click on DefaultAppPool => Set Application Pool Default => Change .Net Version to V 4.0. (You can also change
.Net Framework Version of your application specifically)
Hope, it'll work.
for IIS 7 try according to the given picture ... mark me helpful if it works for you.
I had to register ASP.Net in IIS to get it resolved in the Windows Server 2008 R2. Sreenshot of the commands attched below
cd /d C:\Windows\Microsoft.NET\Framework\v4.0.30319
iisreset /stop
aspnet_regiis -i
iisreset /start
%systemroot%\system32\inetsrv\appcmd set config /section:isapiCgiRestriction /[path='%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll'].allowed:True
%systemroot%\system32\inetsrv\appcmd set config /section:isapiCgiRestriction /[path='%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll'].allowed:True
I'm using IIS Express, rather than IIS.
The problem was in the applicationhost.config file located in: {solution_folder}\.vs\config\applicationhost.config.
One of the application pool entries had a managedRuntimeVersion value of "v2.0". I changed it to "v4.0", and it worked properly.
I'm fairly sure the root cause was one of the NuGet packages I had installed recently.
<system.applicationHost>
<applicationPools>
<add name="BadAppPool1" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
</applicationPools>
</system.applicationHost>
Change the application pool to target framework 4.0 instead of classic .
RC website ->manage website->advanced setting>
the first option change from classic to framework 4 integrated.
Open Project -> press Shift + F4 (Open properties page) -> Chose Build -> in Target Framework chose .NET Framework 4 -> OK
I also got the same issue while running my application locally which is pointing to .Net Framework 4.7.1.
The bug was "Unrecognized attribute TargetFrameWork" as shown below.
But none of the above answers helped me. At last when I changed my present port (1413) number to some other value(60179) as shown below it worked fine for me.But I am not sure for the actual reason behind this , but it worked.
Create a new pool by selecting .Net Framework v4.0.3xxxxx
use the Manage Pipeline Mode: Integrated
Assign it to your site and done.
To fix this problem simply click the ASP.NET Version icon in the Site Tools section of Control Panel to switch the framework to 4.0.
I had this error from a failed MSBuild compile, in a project file converted from an earlier version of VS into VS2010 and .NET 4.0. It was actually a Web Deployment project, and the solution that worked for me was adding the following entries into the PropertyGroup section at the start of the MSBuild file:
<ProductVersion>10.0.11107</ProductVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
Maybe these get automatically updated when other types of project are converted in VS2010, but they were missing from my Web Deployment project file after it was converted.
What I did:
I did change the value of Application Pool to DefaultAppPool from a previous value. You do this in the Advanced Settings (Website --> Manage Website --> Advanced Setting>.
Just had this in VS 2010.
Fixed by editing the .sln file and changing the TargetFrameworkMoniker to have the value ".NETFramework,Version%3Dv4.0" assigned to it.
If you're using IIS Express, it creates a new configuration for each site that you run, and it's bound to the url (host/port). However, when it opens a new project using the same port it doesn't refresh the configuration.
This means that if you have a project using CLR 2.0 (.NET Framework 2.0 to 3.5) running on some port and then later you open another project in the same port using CLR 4 (.NET Framework 4.x+) the new project will try to run using CLR 2, which fails - and in case it doesn't even recognize the "targetFramework" attribute.
One solution is cleaning IIS Express sites, but the easiest method is changing the port so that IIS Express will create a new site (using CLR 4) for your project.
If you compile the files and the value of the "targetFramework" is set as being a particular version i.e. 4.0,
Make sure the host is running .net framework as the same version stated.
If not, download the .net framework.
After downloading, if it is not automatic being set in the IIS manager to be using the extension of the newly downloaded version of .net framework,
add the extension manually by going to the folder of the recently downloaded .net framework THROUGH IIS manager:
1.right-click website folder
2.go to "Properties"
3.under "virtual directory" , click "configuration"
4.edit the executable path of extension ".aspx" (of which the path being pointed to version other than the version of the recently downloaded .net framework) to the correct path which is the folder of the NEWLY downloaded version of .net framework and then select the "aspnet_isapi.dll" file.
5.click ok!
Just Remove the "Target Framework 4.0" and close the bracket.
It will Work
Follow these two steps:
Register the .net framework version version 4.0 (if it is not registered)
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -i
In the app pool change the .net framework to v4.0
If you install the IIS after the installation of .Net FrameWork. You need install the .net framework again for IIS. So all we need to do is run aspnet_regiis -i. Hope it is helpful.
Saw the error "Unrecognized attribute 'targetFramework'" in the 'Console output' page of Jenkins on a build server.
This was after I changed the 'target framework' for several projects from '.NET Framework 3.5' to '.NET Framework 4' and committed my changes.
In Jenkins the project settings had to be changed. For the solution the 'MSBuild Version' had to be changed from 'v3.5' to 'v4.0'.
Just had this issue deploying a new app to an old IIS box. The investigation led to the v4.5.1 run-time being installed but the app requiring v4.5.2
Nothing apart from installing the correct version of ASP .Net run-time was required.
It could be that you have your own MSBUILD proj file and are using the <AspNetCompiler> task. In which case you should add the ToolPath for .NET4.
<AspNetCompiler
VirtualPath="/MyFacade"
PhysicalPath="$(MSBuildProjectDirectory)\MyFacade\"
TargetPath="$(MSBuildProjectDirectory)\Release\MyFacade"
Updateable="true"
Force="true"
Debug="false"
Clean="true"
ToolPath="C:\Windows\Microsoft.NET\Framework\v4.0.30319\">
</AspNetCompiler>
For layering,
Just change the version of targetFramework in web.config file only, the other things no need change.
I had the same issue and I found this nice poweshell script to update all of your app pools at the same time:
https://gallery.technet.microsoft.com/scriptcenter/How-to-set-the-IIS-9c295a20
Make sure to set you $IISAppPoolDotNetVersion = "v4.0" variable at the top.
following 2 steps will force refresh Visual Studio and IIS Express cache and usually resolve my similar issues:
Simply switch Project framework from 4+ to .Net framework 3.5 and run it
If it ran successfully you can revert it back to your desired 4+ target framework and see that it will probably work again.
Changing the port number for the local development helped me Thanks #Rinay Ashokan.
I have done all the trouble shooting and finally found that the project configurations are stored in the IIS express for the port number.
For anyone having this who doesn't have IIS running on their dev PC, here's what happened to me: I had one website on, overwrote with files from a diff website that was 4 while the previous was 3.5. Got this error. Fixed it simply by changing the directory name of the website, which on a dev PC can be anything, so no problem.
The above are probably more elegant to be sure, but sometimes simple works, IF you can get away with it, i.e., you're in dev rather than QA or Prod.

Why is Edit Configuration Button Disabled in IIS

I have a WCF Web Service hosted in IIS6 and it targets the .NET 4.0 framework. When I right click on the web app in IIS and choose properties > ASP.NET, the Edit Configuration button is grayed out.
If I change the framework to 2.0, it becomes enabled. Am I missing something?
Did you by chance install .NET 4 before installing IIS? You might try running
aspnet_regiis -r
or
aspnet_regiis -iru
Check the documentation with /? to figure out which one is appropriate for your scenario. ALso make sure you're running the .NET 4 version of aspnet_regiis.

Asp.net on visual studio .net 2003 web component Issues

I want to run ASP.NET on VS 2003 but it raises an error which says:
"Visual studio has detected that web server is running asp.net version
1.0.The web application you are creating or opening can be configured to be compliant with asp.net 1.0. However, the web application will
not be able to use the new features from asp.net 1.1."
When I choose the option "Make the application compliant with asp.net 1.0", then it is unable to set the compliance saying
"Visual Studio.NET cannot create or open the application. The
likeliest problem is that required components are not installed on the
local web server. Run Visual Studio.NET setup and add the web
development component."
It seems that you are running Visual Studio 2003 on Vista, which is not supported.
By default, Vista does not include .NET Framework 1.1 SP1. Install it first. Make sure that SP1 is installed. If you look into properties of "c:\Windows\Microsoft.NET\Framework\v1.1.4322\mscorsvr.dll", you should get the version 1.1.4322.2032.
Enable IIS 6 Compatibility in Control Panel -> Program and Features -> Turn Windows features on or off. Check "IIS 6 Management Compatibility" under "Internet Information Servces".
Register .NET 1.1 with IIS by running "c:\Windows\MIcrosoft.net\Framework\v1.1.4322\aspnet_regiis.exe -ir". It will create the Application Pool targeted to Framework 1.1 with Classic pipeline in IIS7 and set Enable32BitAppOnWin64 property to true on 64bit OS.
Allow ASP.NET 1.1 in IIS7. Open the IIS Manager and click on the computer name in left tree. In main window select "ISAPI and CGI Restrictions" and make sure that ASP.NET v1.1.4322 is enabled. If not, select it and click Allow link on right side.
When you create an application on any directory that runs .NET 1.1 or lower, always select Application Pool that is targeted to Framework 1.1. For already configured applications, you have to change it manually.
You may need to update the script map of the ASP.NET application within IIS to use the newer version of the framework. I assume that .NET 1.1 framework and VS 2003 are already installed without issues.
Here is an MSDN article that should explain how to register the ASP.NET application within IIS to use the .NET 1.1 version using the aspnet_regiis.exe tool. Command-line reference for the tool is available here.
Visual Studio.NET cannot create or open the application. The likeliest problem is that required components are not installed on the local web server. Run Visual Studio.NET setup and add the web development component.
I faced this problem when I copied the project folder from the network shared location to my local system.
Solution: Create a empty folder in your local system. Copy the files from the original folder into the newly created empty folder.
In addition to the accepted answer, you may also need to add the actual "Web Development" component that is included with the Visual Studio 2003 setup file.
While in the menu, even after you install ASP.NET v1.1 & associated Hotfixes/security updates, as well as FrontPage Extensions for your version of IIS, you may STILL see a red X over the installation component.
This may seem very hacky, but for some reason the installer doesn't seem to do a very thorough check - just click the "Red X" and the "Update Now!" icon becomes visible, then you can install the component just fine.
Specs: Windows 10, Visual Studio .NET 2003 Enterprise
TIP: If you are running a newer version of IIS, you won't be able to "just create" an ASP.NET 1.1 application pool. You'll need to enter these appcmd.exe commands:
appcmd create apppool /name:"YOURPOOLNAME"
appcmd set apppool /apppool.name:"YOURPOOLNAME" /enable32BitAppOnWin64:true
appcmd set apppool /apppool.name:"YOURPOOLNAME" /managedRuntimeVersion:"v1.1"
appcmd set apppool /apppool.name:"YOURPOOLNAME" /managedPipelineMode:"Classic"
appcmd set apppool /apppool.name:"YOURPOOLNAME" /autoStart:true

Resources