Visual Studio is compiling Asp.Net to 4.0, but I need it to compile to 3.5. Where do I change this?
According to this (right click project, property pages, build) it is targeting 3.5, but I'm fairly certain based on the errors I'm getting with install that it's requiring 4.0 components.
Have you checked the <compilation> section of the Web.config file? If it still reads targetFramework="4.0" try removing/changing this value. This has worked for me in the past.
Don't forget, it doesn't matter what you version you compile too, if the web server is configured to run your app under a particular version, it will do. Some ways will work, ie compiled to 3.5 will work in 4.0 app pool. other way round won't.
On IIS7 the version is defined in the app pool associated with your app. IIS6 it's in the ASP.Net tab.
manually in the web.config file
And Automatically in visual studio, in the solution explorer, right click (in the web icon not in the solution icon) -> property pages -> build -> target framework -> change value.
You can check it, viewing the web.config.
name="system.web.extensions"
type="System.Web.Configuration.SystemWebExtensionsSectionGroup,
System.Web.Extensions, Version=3.5.0.0, Culture=neutral,
it indicate that the web is using net framework 3.5
Related
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.
I'm having trouble migrating the DevExpress elements of an ASP web application from one server to another. I basically copied the files and database over into a new server location and made some adjustments to the web.config file to get it connected to the new database. That got most of the site working and pulling data correctly, but the DevExpress pieces are coming up as undefined.
As far as I can tell, the references in the web.config file and on the respective pages is correct and the dll files themselves are listed in the bin directory so I'm rather stumped as to why they aren't working.
Web.config sample
<compilation debug="true" strict="false" explicit="true">
<assemblies>
...
<add assembly="DevExpress.Web.ASPxGridView.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" />
<add assembly="DevExpress.Web.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=B88D1754D700E49A" />
... and so on
Dashboard.aspx sample
...at top of page...
<%# Register Assembly="DevExpress.Web.ASPxGridView.v10.1, Version=10.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
This was an inherited project, so I haven't tried rebuilding the application in case my machine imports my settings into the project (example: it was made in VS 2008, and I'm running VS Community 2015).
Are there any quirks to making a transfer like this that I just don't know about or has anyone else experienced this issue? Any help would be appreciated.
Thanks
The first thing that comes to mind is that version 10.1 of DevExpress is a very old version, released in Aug '10. It does not support .Net 4, so you'll need to make sure the application pool for IIS running this web app is .NET CLR Version 2.0.
Note that if you are running in Windows Server 2012, it's actually tricky to install .Net 3.5. Google how to do it if you need to.
The next to check of course if all of the dll's referenced are in the Bin folder.
Could you write the error message you are getting? If it does not have any extra information, perhaps the event viewer of the server (under windows logs/applications) has a more detailed description.
I have an old website (asp.net 2.0) that is running on IIS7 on a server happily.
I want to make a change to the code, so I have copied all the source code and appropriate binaries to my desktop (running VS 2012).
However whether I am using IIS or the inbuilt webserver I am getting the following error;
The type 'foo' in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\livesite\169c38ce\cc32b84b\App_Web_qbel5zk4.28.cs' conflicts with the imported type 'foo' in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\livesite\169c38ce\cc32b84b\App_Web_m030ztdd.dll'. Using the one in 'c:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\livesite\169c38ce\cc32b84b\App_Web_qbel5zk4.28.cs'.
This same code worked fine on an older XP PC running VS 2005. I am assuming that this is down to the .net framework, the app pool in iis is set to run as asp.net 2 classic, but the assemblies are being generated under v4 of the framework.
I have tried deleting temporary asp.net files and I am still getting the same issue.
There is only one instance of each of the classes it is objecting about in the project. So how do I fix it so that this works in VS 2012, but still using .net 2.0 ?
Maybe it is a matter of dynamic compilation. By default the "batch" attribute of the "compilation" element in your web.config is true. Something like this :
<compilation defaultLanguage="c#" debug="false" batch="true" targetFramework="4.0" />
With batch="true", whenever a control has to be compiled in a directory, the server compiles all controls (everything?) in its directory.
That may results in conflicts for elements referenced from different locations in your site.
You should try to set batch="false" and to remove your temporary files.
If you still encounter problems, try to do a dummy edit-and-save on the corresponding ascx/cs files.
Hope this will help
I have a web application that I wrote in Visual Studio 2008 that targets .Net Framework 3.5. To test it I used a machine running Windows 7, which means IIS7. My application works just fine on this but when it was deployed to a development server (running server 2003, so IIS6) it doesn't work.
The first few lines of my web.config file are as follows:
<?xml version="1.0"?><configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
The error I get has to do with the type= part of the sectionGroup tag. I don't remember the exact message, but it is something along the lines of 'invalid tag' or 'invalid attribute.'
I have two questions:
First, is anyone savvy enough with IIS to know why this works in 7 and not 6?
Second, why do I need the sectionGroup tag? What does it do?
I checked the dev server to make sure the right version of .net was installed. It has 2, 3, 3.5, and 4, so I should be covered on that front.
I'm rather new to .net (probably obvious by now), so please forgive me if this has been asked a thousand times and it looks like I'm beating dead horses. My googling and searching of stackoverflow didn't provide a solution.
SOLUTION:
The whole problem was IIS not being configured correctly. The asp.net tab of the website's properties was set to 2.0.something. We changed it to 4.0.something (3.5 wasn't an option) and everything works just fine.
Your framework targets .NET 3.5. It probably doesn't matter whether you use the scripting section or not, but the scripting section is configured with 3.5. This is used for the client scripts of the ASP.NET Ajax Scripts.
If you run your application in IIS 6, it depends on which framework version you have configured for the application pool. If you mix your applications, it might start in the wrong version. Check that you configure your pool correctly. Unfortunately I don't have an IIS 6 here I can't remember exactly how you do that. Important is that you have no other application in another .NET version running in the same pool.
what is the cause of this error on below line?
<system.web>
<globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="fa-IR" uiCulture="fa-IR" />
<compilation targetFramework="4.0" debug="true">
<assemblies> <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
Everywhere the problem to this solution was mentioned as re-registering aspNet by using aspnet_regiis.exe. But this did not work for me.
Though this is a valid solution (as explained beautifully here)
but it did not work with Windows 8.
For Windows 8 you need to Windows features and enable everything under ".Net Framework 3.5" and ".Net Framework 4.5 Advanced Services".
Thanks
Neha
This happens when you install .Net 4 before enabling IIS, or if you register WCF after registering .Net 4. In either case, your App Pools will be running .Net 2.0 (which is the CLR version required for .Net 3 if you have registered WCF, which installs ASP.Net 3.5, or the default if you have installed IIS after .Net 4)).
There are many references to this on the web, e.g. the MSDN blogs:
http://blogs.msdn.com/b/webtopics/archive/2010/04/28/system-typeloadexception-for-system-servicemodel-activation-httpmodule-in-asp-net-4.aspx
The fix is to re-register ASP.Net 4 from the correct (32 or 64 bit) Framework folder (Framework64 on a 64bit server), using the aspnet_regiis.exe tool, e.g.
aspnet_regiis.exe -iru
For Windows 8 you need to Windows features and enable everything under .Net Framework 3.5 and .Net Framework 4.5 Advanced Services -> Enable Everything
For windows 8 the above configuration in
Control panel->programs->windows features on/off
enable every thing under".net Framework3.5" and ".net Framework 4.5 advanced Services"
Working fine for me.
Thanks Madhavi.B
I had this problem on a server managed by one of our clients. I didn't have the access to run the aspnet_regiis.exe tool. As a workaround I did the following:
I removed aspNetCompatibilityEnabled="true" from the <serviceHostingEnvironment> tag in the web.config
removed [AspNetCompatibilityRequirements] from the webservice.cs file
Unfortunately this means that for example HttpContext.Current becomes null, I could fix my webservice by rewriting all my HttpContext.Current.Server.MapPath calls to System.Web.Hosting.HostingEnvironment.MapPath
Hope this helps someone.
This problem surfaced for us immediately after we installed the Windows Management Framework 3.0/PowerShell 3.0 sp1 (KB2506143) on a Windows Server 2008 R2 x64. Windows Update then also installed KB2736422, KB2756921, and KB2656411 immediately after.
Our solution was to first uninstall KB2506143 (and the three updates that accompanied that), then run aspnet_regiis.exe -iru as suggested in Ed209's response above. Both steps were necessary to resolve the problem. Thank you, Ed209.
appcmd.exe set config -section:system.webServer/modules /[name='ServiceModel'].preCondition:"managedHandler,runtimeVersionv2.0" /commit:apphost
worked for me