Hi. I've got a problem getting my .NET 4 Web Application to work in IIS 6. I'll retrace what I've done and hopefully someone might spot a gotcha. At least I hope to get an idea of where to look next.
I've upgraded my .NET 3.5 site to .NET 4.0 using Visual Studio 2010 conversion wizard. I've published the site as both a web site and a virtual directory on our Intranet with different results each time. For both configs I have made a separate Application
Pool and associated them with it.
As a WebSite:
I have the site files sitting in their own directory. I set the .NET version to 4.0 in Web Site propeties and use windows authentication only. I restart IIS. The site attempts to authenticate but fails after 3 attempts. I've checked the credentials I'm
entering and they are valid.
As A Virtual Directory:
I have the site files sitting in a subdirectory of the main web application. I set the .NET version to 4.0 in Web Site propeties and use windows authentication only. I restart IIS. When I go to the virtual directory address, I get a page not found error.
There are no errors in Event Viewer that I can see so from here I've no idea what to do to try and figure out why my site won't work.
There are no version selections for Application Pool in IIS6.
But I figured it anyway. I had to allow .net 4 in Web Extensions. So the Virtual Directory method is currently working.
Now I'm getting "value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later" message. I've put a location tag in the parent site web.config file and told it not to inherit, but I still get the error. I'm sure I'll figure
it in time though.
Thanks for posting.
Marked as answer by chrisdid on Apr 28, 2010 11:21 PM
Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Source Error:
Line 10: <customErrors mode="Off" /> Line 11: Line 12: <compilation debug="true" targetFramework="4.0" /> Line 13: </system.web> Line 14:
<p>With the new .NET 4 framework, comes some problems if you are running it on IIS 6 Windows Server. IIS 6 does not let you have more than one framework at the time running in the same instance like IIS7 that can create Application Pool targeting different
framework. </p>
When IIS 6 runs under ASP.NET 2.0 (3.0 and 3.5 are superset, not frameworks) you are going to hit this error if the application is 4.0
Configuration Error Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
You have a few options;
1. Downgrade the .NET application to 3.5 that Visual Studio 2010 makes it really easy. Just go to the Website properties -> Application tab and there is a drop down with all the framework releases, select 3.5, you VS2010 will reload the project and modify
the web.config, if you added web service reference, that you may have to delete them and re-add them under 3.5
2. To configure the IIS6 and web config to solve the issue. I deal with the second part:
1. In IIS 6 console, you need to right click you project and click the property and check the ASP.Net tab whether Framework 4 is selected or not. If not select the framework 4. But still you might face the same error because of the application pool; you
might have same application pool for two different framework web application. IIS 6 does not let you have more than one framework at the time running in the same instance (means single application pool can’t use for two different frameworks) like IIS7 that
can create Application Pool targeting different framework.
2. To solve this issue you need to create application pool and assigned this application pool to you framework 4 web application. To assign the application pool, in IIS console open the properties section of the web application, and click on the “Home directory”
tab and selection application pool which you have created earlier from drop-down-list.
3. This two might now solve your problem completely sometime. You can get the error as “404 Page is not found”. Though you might now have any issue while in development time.
4. Basically page is not found issue is cause of other problem which is set hidden by is IIS6 . But you need to see the real cause. What you have do here is go to the IIS6 console open “web service extension node” which is right below the “default website”
node. You will see the entire ASP.Net framework list over there, by default these frameworks might be prohibited so please select ASP.Net Framework 4 and click allow button. Browse you website now, you get other error beside “404 Page is not found”. You might
get the error as listed below:
5. The value for the 'compilerVersion' attribute in the provider options must be 'v4.0'
You’ll see following error when browsing the website
The value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later if you are compiling for version 4.0 or later of the .NET Framework. To compile this Web application for version 3.5 or earlier of the .NET Framework, remove the
'targetFramework' attribute from the element of the Web.config file.
To solve this issue, you need to modify your web config file as below:
Previously the CompilerVersion value is set as v3.5 but we already change our targetFranework to 4. Thus according to the error message above the 'compilerVersion' attribute in the provider options must be 'v4.0' or later if you are compiling for version
4.0 or later of the .NET Framework. Hence your new setting will be as below:
Thank you bibekweb. I had the same issue VS 2010, 4.0 framework, IIS6 on a vmMachine. IIS6 had 4.0 marked as "Prohibited" in the Web Service Extensions. Wonder why? Very odd......
I've been scouring the web trying to workout the correct way to get .NET4.0 working on IIS 6. I've found a lot of useful suggestions but no complete solution. With a bit of luck though, I finally found how to do it properly. It doesn't involve commenting
out code (like the "targetframework" attribute in your web config file) and it doesn't involve any other shortcuts.
Just do this:
- install .net frame work 4.0 on your web server
- within IIS, go to "web service extensions" and ensure that .NET 4.0 has been added and allowed
- setup a new application pool for your .NET 4.0 websites/webapps. In IIS 6 only one framework can run within a given app pool, so just use this pool for .NET 4.0 stuff
- create your virtual directory as usual
- right click on it and select properties. From the "virtual directory" tab, ensure that you have selected the .NET 4.0 app pool you created above
- also from the "virtual directory" tab, click "configuration" and go to the "mappings" tab
- this is the key bit. Under application mapping, ensure that the executable path for each extension you want to use is mapped to the correct .NET 4.0 DLL. For instance, on my system I wanted to configure a WCF .svc file to run under .NET 4.0. So, I selected
.svc extension, clicked the "edit" button below and then browsed to the .NET 4.0 framework directry rather than the old .NET 2.0 one which was there already. I then chose the corresponding aspnet_isapi.dll file and clicked ok. Voila! It all works.
This is now up and running in corporate environment and seems to be fine.
I hope this helps somebody else out there.
-James
Marked as answer by Chen Yu - MSFT on Mar 19, 2013 06:35 AM
Hey, just had to tackle this myself and because its quite a recent thread I thought i'd chip in.
Server:
Windows 2003 64 bit
IIS6
Steps I had to take are as follows:
Install framework 4.0 on the computer (this was already done a while back)
within IIS, go to "web service extensions" and ensure that .NET 4.0 has been added and is allowed (not prohibited)
used plesk to move the site in question into its own application pool. This is important apparently as it can confuse IIS if you try to have websites targeting different framework version in the same application pool
Run the following command prompt commands (assuming you know how to use cmd prompt):
Click start | run | type cmd | press enter
type cd C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
use the aspnet_regiis tool by typing: aspnet_regiis -sn W3SCV/{SITEID}/ROOT replacing {SITEID} with the number you got from the article above.
In my case the cmd looked like:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -SN W3SVC/3868/ROOT
Start registering ASP.NET (4.0.30319) at W3SVC/3868/ROOT.
Finished registering ASP.NET (4.0.30319) at W3SVC/3868/ROOT.
You can then use aspnet_regiis -lk to list all the sites and which versions they are configured to, which now shows my site is configured to asp.net 4
The first article is aimed at showing you how to set the defaults for sites on your server from here on out so my steps above are a slight variation as I only wanted to set two specific sites to use asp.net 4 and the rest to continue defaulting to asp.net
2.0.
Marked as answer by Chen Yu - MSFT on Mar 19, 2013 06:35 AM
ChrisDid
Member
12 Points
4 Posts
.NET 4.0 and IIS 6 Deployment problem
Apr 27, 2010 03:45 AM|LINK
Hi. I've got a problem getting my .NET 4 Web Application to work in IIS 6. I'll retrace what I've done and hopefully someone might spot a gotcha. At least I hope to get an idea of where to look next.
I've upgraded my .NET 3.5 site to .NET 4.0 using Visual Studio 2010 conversion wizard. I've published the site as both a web site and a virtual directory on our Intranet with different results each time. For both configs I have made a separate Application Pool and associated them with it.
As a WebSite:
I have the site files sitting in their own directory. I set the .NET version to 4.0 in Web Site propeties and use windows authentication only. I restart IIS. The site attempts to authenticate but fails after 3 attempts. I've checked the credentials I'm entering and they are valid.
As A Virtual Directory:
I have the site files sitting in a subdirectory of the main web application. I set the .NET version to 4.0 in Web Site propeties and use windows authentication only. I restart IIS. When I go to the virtual directory address, I get a page not found error.
There are no errors in Event Viewer that I can see so from here I've no idea what to do to try and figure out why my site won't work.
iis 6 .NET 4.0 authentication
Jalpesh P. V...
Contributor
2052 Points
331 Posts
Re: .NET 4.0 and IIS 6 Deployment problem
Apr 27, 2010 08:16 AM|LINK
I think you have not selected version for application pool. You need to select version of .net framework for application pool also.
Cheers,
Microsoft MVP(Visual C#),
www.dotnetjalps.com
Mark as answer if my anwers helps you
ChrisDid
Member
12 Points
4 Posts
Re: .NET 4.0 and IIS 6 Deployment problem
Apr 28, 2010 11:21 PM|LINK
There are no version selections for Application Pool in IIS6.
But I figured it anyway. I had to allow .net 4 in Web Extensions. So the Virtual Directory method is currently working.
Now I'm getting "value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later" message. I've put a location tag in the parent site web.config file and told it not to inherit, but I still get the error. I'm sure I'll figure it in time though.
Thanks for posting.
traitimvietn...
Member
14 Points
23 Posts
Re: .NET 4.0 and IIS 6 Deployment problem
Jun 18, 2010 03:05 AM|LINK
same problem .
Pyrex
Member
15 Points
9 Posts
Re: .NET 4.0 and IIS 6 Deployment problem
Jun 18, 2010 08:12 PM|LINK
removing <compilation debug="false" strict="false" explicit="true" targetFramework="4.0" />
from web config worked for me.
traitimvietn...
Member
14 Points
23 Posts
Re: .NET 4.0 and IIS 6 Deployment problem
Jun 19, 2010 01:19 AM|LINK
my server :
os windown server 2003
iis 6.0
install .net 4.0
and here error when run script:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
Source Error:
bibekweb
Member
18 Points
5 Posts
Re: .NET 4.0 and IIS 6 Deployment problem
Jul 08, 2010 08:37 AM|LINK
<p>With the new .NET 4 framework, comes some problems if you are running it on IIS 6 Windows Server. IIS 6 does not let you have more than one framework at the time running in the same instance like IIS7 that can create Application Pool targeting different framework. </p>
When IIS 6 runs under ASP.NET 2.0 (3.0 and 3.5 are superset, not frameworks) you are going to hit this error if the application is 4.0
Configuration Error Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive.
You have a few options;
1. Downgrade the .NET application to 3.5 that Visual Studio 2010 makes it really easy. Just go to the Website properties -> Application tab and there is a drop down with all the framework releases, select 3.5, you VS2010 will reload the project and modify the web.config, if you added web service reference, that you may have to delete them and re-add them under 3.5
2. To configure the IIS6 and web config to solve the issue. I deal with the second part:
1. In IIS 6 console, you need to right click you project and click the property and check the ASP.Net tab whether Framework 4 is selected or not. If not select the framework 4. But still you might face the same error because of the application pool; you might have same application pool for two different framework web application. IIS 6 does not let you have more than one framework at the time running in the same instance (means single application pool can’t use for two different frameworks) like IIS7 that can create Application Pool targeting different framework.
2. To solve this issue you need to create application pool and assigned this application pool to you framework 4 web application. To assign the application pool, in IIS console open the properties section of the web application, and click on the “Home directory” tab and selection application pool which you have created earlier from drop-down-list.
3. This two might now solve your problem completely sometime. You can get the error as “404 Page is not found”. Though you might now have any issue while in development time.
4. Basically page is not found issue is cause of other problem which is set hidden by is IIS6 . But you need to see the real cause. What you have do here is go to the IIS6 console open “web service extension node” which is right below the “default website” node. You will see the entire ASP.Net framework list over there, by default these frameworks might be prohibited so please select ASP.Net Framework 4 and click allow button. Browse you website now, you get other error beside “404 Page is not found”. You might get the error as listed below:
5. The value for the 'compilerVersion' attribute in the provider options must be 'v4.0'
You’ll see following error when browsing the website
The value for the 'compilerVersion' attribute in the provider options must be 'v4.0' or later if you are compiling for version 4.0 or later of the .NET Framework. To compile this Web application for version 3.5 or earlier of the .NET Framework, remove the 'targetFramework' attribute from the element of the Web.config file.
To solve this issue, you need to modify your web config file as below:
<providerOption name="CompilerVersion" value="v3.5"/>
Previously the CompilerVersion value is set as v3.5 but we already change our targetFranework to 4. Thus according to the error message above the 'compilerVersion' attribute in the provider options must be 'v4.0' or later if you are compiling for version 4.0 or later of the .NET Framework. Hence your new setting will be as below:
<providerOption name="CompilerVersion" value="v3.5"/>
Hope this will solve your ASP.Net 4 migration and hosting issue at IIS6.
NET 4.0 and IIS 6 Deployment problem
funluckykitt...
Participant
1470 Points
1550 Posts
Re: .NET 4.0 and IIS 6 Deployment problem
Oct 15, 2010 01:10 PM|LINK
Thank you bibekweb. I had the same issue VS 2010, 4.0 framework, IIS6 on a vmMachine. IIS6 had 4.0 marked as "Prohibited" in the Web Service Extensions. Wonder why? Very odd......
jambot
Member
12 Points
1 Post
Re: .NET 4.0 and IIS 6 Deployment problem
Oct 21, 2010 12:36 PM|LINK
Hi,
I've been scouring the web trying to workout the correct way to get .NET4.0 working on IIS 6. I've found a lot of useful suggestions but no complete solution. With a bit of luck though, I finally found how to do it properly. It doesn't involve commenting out code (like the "targetframework" attribute in your web config file) and it doesn't involve any other shortcuts.
Just do this:
- install .net frame work 4.0 on your web server
- within IIS, go to "web service extensions" and ensure that .NET 4.0 has been added and allowed
- setup a new application pool for your .NET 4.0 websites/webapps. In IIS 6 only one framework can run within a given app pool, so just use this pool for .NET 4.0 stuff
- create your virtual directory as usual
- right click on it and select properties. From the "virtual directory" tab, ensure that you have selected the .NET 4.0 app pool you created above
- also from the "virtual directory" tab, click "configuration" and go to the "mappings" tab
- this is the key bit. Under application mapping, ensure that the executable path for each extension you want to use is mapped to the correct .NET 4.0 DLL. For instance, on my system I wanted to configure a WCF .svc file to run under .NET 4.0. So, I selected .svc extension, clicked the "edit" button below and then browsed to the .NET 4.0 framework directry rather than the old .NET 2.0 one which was there already. I then chose the corresponding aspnet_isapi.dll file and clicked ok. Voila! It all works.
This is now up and running in corporate environment and seems to be fine.
I hope this helps somebody else out there.
-James
rtpHarry
All-Star
56620 Points
8958 Posts
Re: .NET 4.0 and IIS 6 Deployment problem
Nov 02, 2010 11:18 PM|LINK
Hey, just had to tackle this myself and because its quite a recent thread I thought i'd chip in.
Server:
Steps I had to take are as follows:
http://weblogs.asp.net/owscott/archive/2006/05/30/ASPNet_5F00_regiis.exe-tool_2C00_-setting-the-default-version-without-forcing-an-upgrade-on-all-sites.aspx
What that article told me in broad terms was:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -SN W3SVC/3868/ROOT
Start registering ASP.NET (4.0.30319) at W3SVC/3868/ROOT.
Finished registering ASP.NET (4.0.30319) at W3SVC/3868/ROOT.
The first article is aimed at showing you how to set the defaults for sites on your server from here on out so my steps above are a slight variation as I only wanted to set two specific sites to use asp.net 4 and the rest to continue defaulting to asp.net 2.0.