Setting up an ASP.NET website - asp.net

I am trying to set up a web site for my new business, Antech, but I can't seem to get my landing site to point to 'Default.aspx'. Do I have to use IIS and if so does IIS Express work? I am continually coming up with the following error in my Web.config file (to see the actual error you can go to my website here):
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:
Line 24: </connectionStrings>
Line 25: <system.web>
Line 26: <compilation debug="true" targetFramework="3.5">
Line 27: <assemblies>
Line 28: <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Source File: \\boswinfs07\home\users\web\b341\dom.antechdevelopmen\web.config Line: 26
Version Information: Microsoft .NET Framework Version:2.0.50727.3634; ASP.NET Version:2.0.50727.3634
Thanks for your help in advance!

It could be because of two reasons:
The application pool of your site could be set for .net framework 2.0
.Net 4.0 is not installed on your machine.
Try changing your app pool to 4.0.
If app pool doesn't have 4.0 framework listed, you might want to register it. For same follow below link that shows how to do it.
https://stackoverflow.com/a/4890368/309395

It looks like your application pool is set to .Net framework 2.0.
The targetFramework attribute was only introduced in .Net 4.0. You can either manually remove the targetFramework="3.5" from the config file, or change your app pool to .Net framework 4.0
From http://msdn.microsoft.com/en-us/library/bb398791.aspx :
Visual Studio automatically inserts the targetFramework attribute when you upgrade a project to the .NET Framework 4. It removes the attribute when you change a project's target from the .NET Framework 4 to an earlier version.

Related

ASP.NET MVC4 to 5 Upgrade

I have had to take a very old project out of it's dusty box and upgrade it from 4 to 5 and I followed the guidance on the MS Site (https://learn.microsoft.com/en-us/aspnet/mvc/overview/releases/how-to-upgrade-an-aspnet-mvc-4-and-web-api-project-to-aspnet-mvc-5-and-web-api-2) and it all works perfect locally on my dev machine. Yep it works on my machine so ship it right....
Well No because I publish to the server and this is where the issues start as I keep getting errors saying:
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: The 'targetFramework' attribute in the
element of the Web.config file is used only to target
version 4.0 and later of the .NET Framework (for example,
''). The 'targetFramework'
attribute currently references a version that is later than the
installed version of the .NET Framework. Specify a valid target
version of the .NET Framework, or install the required version of the
.NET Framework.
I have checked that the Web.Config file has the Target set to 4.7.1 and on the server the current version is 4.7.2 so where am I going wrong.
The line in the Web.Config that is being referenced is:
<compilation debug="true" targetFramework="4.7.1" />
And at the bottom of the error page:
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2106.0
I like my local machine too much to ship it to the cloud so someone please help. I have been bashing my head against the desk for hours now and Google/Bing etc are not helpful.
Have you tried to install "Runtime" SDK on the server?
The runtime SDK for Framework 4.7.1 can be found here:
https://www.microsoft.com/net/download/visual-studio-sdks
If you haven't done it, try it!
Probably you don't have the .Net version in the hosting server just install the .Net version in the server.
.Net 4.7.1 Offline Installer
Thanks for the responses but this site is hosted on a shared hosting platform so I can't install anything, but I checked and they have 4.7.2 installed.
I fixed the problem by removing the targetFramework from the compilation settings and worked a treat.
Old:
<compilation debug="true" targetFramework="4.7.1" />
New:
<compilation debug="true" />
Thanks for the help. Now onto the next issue.

Which .net version is used ? The one in web conifg or the one used while building?

Probably a noob question but what version of .NET is used in a ASPX web application? Is it the version defined in the project propperties or the one defined in the web.config file of the website?
I need to know this because an API I am using in the web application is closing all non TLS1.2 protocolls. And as far as I understand TLS1.2 is the default in .NET 4.5. The server is Windows Server 2008.
Visual Studio uses web.config values to initialize the property pages. So, they're one in the same.
You see the .NET version from the property pages in the web.config similar to this:
<configuration>
<system.web>
<compilation targetFramework="4.5" />
</system.web>
</configuration>
If you change the target framework in the project properties and save, you should see the updated target framework in that value in your web.config file.

Unrecognized attribute 'controlRenderingCompatibilityVersion'

We are replacing our win2k3 server (iis6) with a win2012 (iis8) and when we move the asp.net apps over from the old server, configure them as applications and point them to the 2.0 framework, then attempt to run we get this:
Unrecognized attribute 'controlRenderingCompatibilityVersion'
Line 2: <configuration>
Line 3: <system.web>
Line 4: <pages controlRenderingCompatibilityVersion="4.5" />
Line 5: </system.web>
Line 6: </configuration>
Version Information: Microsoft .NET Framework Version:2.0.50727.6407; ASP.NET Version:2.0.50727.6406
I have been trying things all day and the strange thing is that the source file points the IIS's root web.config even though the application has it's own with the tag.
Please note this is a legacy app that cannot be updated to asp.net 4+.
Any help would be appreciated.
Found something that worked for me finally. I did the manual conversion of the web.config in this link:
http://msdn.microsoft.com/en-us/library/dd483478(v=vs.100).aspx
Then I upgraded the app pool to 4.5 (4 was not an option for me but it might be for you).

Old web application on server with .NET 4.0 stopped working

I have an old ASP.NET web application on a server, which was developed in Visual Studio 2008 in the year 2008. The server now has .NET 4.0 installed also. When I try to access the web app I get:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1703: An assembly with the same identity 'System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' has already been imported. Try removing one of the duplicate references.
Source Error:
[No relevant source lines]
Is there anything I can do to get it to work without access to the original Visual Studio solution? I believe it has to do with the fact that .NET 4.0 is also installed on the server.
1) Have you checked the application pool your application is running under? Is it still .net 2.0 integrated/classic, or has it automagically changed to 4.0? If so, try changin back to 2.0.
2) Do you by any chance have a System.Web.Extensions.dll in the bin folder of the application? If so, try renaming it (similar situation as here)
3) If 1 is not an option and 2 is not the case, do you have any explicit references to the System.Web.Extensions in the app's config file? Are they requesting a different version of the file?

asp.net web-config error

I have still problem with asp.net project. In Visual studio when i start debug it is all good and page working but, when i try it on iis7 showse this error.
SHOW ERROR:
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:
Line 18: </connectionStrings>
Line 19: <system.web>
Line 20: <compilation debug="true" targetframework="4.0" />
Line 21: </system.web> Line 22:
Source File: C:\inetpub\wwwroot\web.config Line: 20
It seems problem with targetFramework but i do not know if i have to configure iis server or something chane in my web-config.
thx.
Change the .NET version on the Application pool for your website.
It must be .NET 4.0, not the .NET 2.0
View a List of Application Pools (IIS 7)
Ensure the application pool is set to use .NET 4.0.
Change your application pool to be compatible with .NET 4.0.
Open IIS then click on an application pool on the list and modify it to use .NET Framework 4.0.

Resources