I'm trying to publish my first ASP.Net website, but I'm getting this error when I try to visit the homepage.
Unrecognized attribute 'targetFramework'. Note that attribute names
are case-sensitive.
Here's the section of the web.config file it is referencing:
<system.web>
<customErrors mode="Off" />
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
</system.web>
And here's the website itself if you want to see the full error page:
http://connellchamberofcommerce.com/
Is the ASP.Net version (4.5.2) supposed to match the .Net version my host uses or something? As I said, this is my first ASP.Net website and I'm pretty confused by this error.
The version information at the bottom of http://connellchamberofcommerce.com/ indicates that the .net version of app pool is 2.0.50727.5491, where as in your web.config file its 4.5.2. So change the app pool to use 4.0.
Your web.config looks fine to me. My guess would be that you have set the wrong .NET version in the AppPool under which your site is running.
Go to your IIS -> Select your desired AppPool -> Click Basic settings and change the .Net version accordingly.
Related
I have already deployed website and API in .NET
targetFramework="4.6.2".
This app is hosted in IIS.
As Framework="4.6.2" will be no longer supported by Microsoft after 26 April 2022, I need to update from 4.6.2 to 4.7.2.
Note: I don't have source code of application to rebuild the solution.
so I only changed in config file in IIS
Current:
<system.web>
<compilation debug="true" targetFramework="4.6.2" />
<httpRuntime targetFramework="4.5" />
<!--... many other things -->
</system.web>
Updated:
<system.web>
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.5" />
<!--... many other things -->
</system.web>
The application is running fine I did not get any error but I am not sure this will upgrade .NET framework for my project or not ?
What are the pros and cons ?
The compilation target framework represents the framework that was targeted at the time of compilation.
However, the http runtime target framework is used to make decisions on how we should configure the CLR before loading your application into memory. The target framework of httpruntime can have a lower framework version than the one application was compiled into, in the case where backward compatibility needed or in situation when .NET Framework on server where application is deployed has lower version installed.
Ideally it won't break anything if you directly change the target framework to a higher version than existing in web.config. But check this article for more details. Also make sure to check if target .NET framework installed on server.
<system.web>
<compilation targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" />
</system.web>
I have a simple MVC web api 2 IIS hosted application which I want to enable windows authentication (initially not using Owin). I am running this on my development machine and running as local IIS.
So, from what I could find, I need to add the following to the web.config
1: to the following section the authentication mode="Windows"
<system.web>
<compilation debug="true" targetFramework="4.5.1"/>
<httpRuntime targetFramework="4.5.1"/>
<authentication mode="Windows" />
</system.web>
2: Then add the following
<system.webServer>
<security>
<authentication>
<windowsAuthentication enabled="true"/>
</authentication>
</security>
When I add the above and run the application (in debug from Dev studio), I get the following error
HTTP Error 500.19 - Internal Server Error
Config Error This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="Deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false".
and then it specifically points to this web config entry
Config Source:
37: <authentication>
38: <windowsAuthentication enabled="true"/>
39: </authentication>
Anyone have any ideas why I would be getting this?
Also, I noticed when I switch to IIS express, that in the project properties, the Windows Authentication is set to disabled, and grayed out so I cannot set it here either.
Thanks in advance for any help!
If you read applicationHost.config, you will see that authentication related sections are locked down and cannot be overridden in web.config,
<section name="windowsAuthentication" overrideModeDefault="Deny" />
Thus, you need to specify that in applicationHost.config, instead of web.config. Both IIS and IIS Express have such restriction.
I am deploying a .Net solution to Azure and am getting the above error when I try to run the page.
I read that System.Web has to be stripped down to this. And that's what I did.
<compilation debug="true" targetFramework="4.7.2" />
<httpRuntime targetFramework="4.7.2" />
The solution works locally. Application Insights does not note any errors. Is there an error log somewhere? I have no idea what error this could be. It could be anything.
(I don't have 50 rep so I can't comment, so I have to post as an answer.)
Enable diagnostics logging and report back with the logs. Should shed some light on the problem.
Try setting custom errors to off in your web.config.
<system.web>
<customErrors mode="Off">
</customErrors>
</system.web>
Reference: customErrors Element (ASP.NET Settings Schema)
Don't forget to turn it back on when you have fixed the issue.
I developed an ASP.NET web application that is installed on a "live" IIS 7.5. The web app uses http sessions to pass parameters between pages for logged in users. This works great on my development machine (tested with local IIS in VS2010 IDE), but when this web app is uploaded to a client's IIS and they start using it (Google Chrome and IE browsers), at some random moments the session variables seem to disappear. My first guess was to increase the session timeout setting via web.config file by adding this line:
<configuration>
<system.web>
<sessionState timeout="20"></sessionState>
</system.web>
</configuration>
But that doesn't seem to fix the issue. So it made me wonder, what other settings are there concerning sessions? Something like an internal folder that keeps a cache of all sessions that gets overflown on an actual IIS? Any ideas?
EDIT: Following #wy__'s suggestion, I modified the web.config file and started seeing the same issue on my dev machine. Here's the whole system.web section as I have it now:
<system.web>
<compilation targetFramework="4.0" debug="false"/>
<pages validateRequest="false"/>
<httpRuntime requestValidationMode="2.0" executionTimeout="110" maxRequestLength="262144"/>
<sessionState timeout="20" cookieless="true" regenerateExpiredSessionId="true"></sessionState>
</system.web>
I also checked and there's only one w3wp.exe process running.
By default, the session uses cookies to track user sessions. If you are not sure whether users turn them off or not, you can configuring cookieless session.
i.e.
<configuration>
<system.web>
<sessionState cookieless="true" regenerateExpiredSessionId="true" />
</system.web>
</configuration>
I get parse error after uploading my Web Application to my server. I had an ASP.NET Web Site, but I migrated my files into a Web Application Project. Now, after I completed moving the files to the new project, everything works all right locally, but not at the remote server.
now afther i upload it to the server i get this error:
EDIT--------
this problem just keeping coming back even afther i tried put namespaces on of the .cs files
and republish the site.
even afther i publish the site all the CodeBhind files desapper so i add them myself via copy-past.
here how the solution explorer look and 1 of my aspx. files mybee you will see somthing worng i did:
here is my config file code:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
</compilation>
</system.web>
</configuration>
EDIT-----------------------------------------
i can see the site now online, what i needed to do is give all the files the same namespace, and not use a out side folder (witch i used every time) i just drop all the files/folders in the webroot thank you all!.
You probably have to set up namespaces for your entire project. Look at this walkthrough from Scott Gu's blog. It's for Visual Studio 2005, but it's pretty much the same.
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0">
</compilation>
</system.web>
</configuration>
As per your web.config your target framework is 4.0 . Have you checked same your web site running in application pool in IIS is working on the same framework version?
If the framework is different on IIS than it might be cause of it. You can check it by Select the site on IIS, click ASP.NET tab, select ASP.NET version dropdown box.
I suspect you did not deploy the code-behind: main.aspx.cs