How do disable .net framework 3.5 on IIS 6 - asp.net

Is there are some ability to disable .net 3.5 on IIS 6 for asp.net site? I just have an application (.net 2.0) that has not working on server with .net 3.5, is throw :
Attempted to read or write protected
memory. This is often an indication
that other memory is corrupt.
Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.
Exception Details:
System.AccessViolationException:
Attempted to read or write protected
memory. This is often an indication
that other memory is corrupt.
Thanks in advance.

Please post the complete exception. Also, is the failing application a .NET 3.5 application? There is no "disable" in IIS because .NET 3.5 uses the .NET 2.0 CLR, just like .NET 2.0 and 3.0 did. .NET 3.5 does install service packs.

You shouldn't have to "disable" anything. Your application should still be running in a v2.0 AppPool.
Scott Hanselman's blog post How to set an IIS Application or AppPool to use ASP.NET 3.5 rather than 2.0 is sort of the reverse of what you're asking, but it should help explain the situation more clearly.
In particular:
[web.config is] where your web site is
told what version of the compiler to
use, and the new supporting libraries.
This is where you tell ASP.NET to use .NET 3.5, not in IIS. IIS
AppPools know about CLR versions, not
Framework and compiler versions, those
are set by the application.
So your application is still running on the .NET 2.0 CLR, even if you have .NET 3.5 installed.

I realise this is quite an old topic, but I had this issue today and managed to resolve it by deleting some registry entries.
Open "Regedit" and look for HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft.NETFramework\Security\Policy\Extensions\NamedPermissionSets
Export the keys in case you break something, then you can restore the original configuration.
Within this key you will have a number of sub keys (I had 'Internet' and 'Intranet')
Look at the values in the subkeys and remove any Keys which refer to versions of .NET later than 2.0.5027
I suppose the alternative to this would be to register the appropriate library and/or classes in your web.config.
Hope this helps the OP or anyone else having the same problem.

Not sure if this any use for you, but I think you can declare the required runtime for your site in the web.config file. Check out this blog post. By specifically declaring which version of the .NET framework you want your site to use, it might help.
<configuration>
<startup>
<requiredRuntime version="v2.0.5027"/>
</startup>
</configuration>

Related

Framework upgrade from .net 3.5 to .net 4.8

I'm working with one of my clients wherein they are having a few application still written on .net framework 3.5. Though we still have support for .net 3.5, client wishes to upgrade the framework to 4.8. There are no plans to migrate to core/.net 6 as of now but to upgrade to framework's latest version 4.8.
I'm looking for some pointers to migrate an application from 3.5 to 4.8, what could be the runtime changes/retargeting changes/breaking changes. It would be of great help if someone could give me a roadmap to address the problem - where to start from, what details to look into etc. I searched a lot and could not get any specific pointer for my use case. Please help.
Thanks in advance!
Well, in most cases, you should be able to simple set the project up to say .net 4.8 (or 4x). But, you might as well go all the way.
You WILL however has to download and install .net 4.8 on the web server. So, on your developer computer, you most likly do have .net 4.8. But, don't forget to download + install .net 4.8 on the web server (or if it is a hosted plan, find out what is the level of .net they support).
So, for the most part, you should be able to simple in your project, set it as 4.8, and see if it compiles. You have a VERY good chance it will.
That would be this setting project->"my project name properties"
So, the above for the most part should make things work.
Also, once you done the above, (then re-build all). You want to check web.config, and this setting:
<httpRuntime targetFramework="4.8" maxRequestLength="2000000"/>
As noted, you also have to check/ensure that the web hosted server (if this is not a on-site server) also needs the .net frameworks to be downloaded and installed. Often they already are but you want to check that.
It also possible that you are using a asp.net web site as opposed to a asp.net web site application, and thus the above steps do change somewhat.

Moving an ASP.NET project to .NET 4

I'm moving an ASP.NET project from .NET 3.5 to .NET 4.
Everything works beautifully if I'm debugging under web.dev (ie. in Visual Studio [2010]) but as soon as I try and run this under IIS7[.5] the debugger fails to attach. Running the project directly under IIS just causes it to throw back 403s (no subcode, so not much help there).
I setup the site by taking the current (and working!) .NET 3.5 site, and changing the AppPool to one with the .NET 4 runtime. I've confirmed that all file permissions are kosher (at least from the .NET 3.5 perspective). I feel as though I'm missing some configuration step here...
The error message when trying to attach the debugger is just "Unable to start debugging on the webserver." Not the most useful error message in the world.
Directly attaching to the associated w3wp process strongly suggests that the application is never spun up successfully.
The basic question is, how would I affect this change over from .NET 3.5 to .NET 4 for a project running under IIS?
Figured it out.
.NET 4 had not been installed for IIS purposes. Don't ask me why that was the case.
Running asp_net_regiis -i in the .NET 4 install directory (\Windows\Frameworks\v4.0.xxxx) under the Visual Studio Command Prompt (x64 in my case) solved the problem.
You cannot mix .NET frameworks in the same app pool. So ensure that only .NET 4.0 web sites are in your app pool.
Remember to set the web site/virtual directory to .NET 4 as well.
IIS7 has two options within a "website". In IIS6 you'd add a sub-app as a "Add Virtual Directory..." in IIS7 doing so forces you to keep the same AppPool and thus .NET framework version as the website.
But, IIS7 now has an "Add Application..." options, which allows you to essentially do what IIS6 had allowed, so that you can explicitly state the AppPool to run in and it can differ from the parent website.
Start a fresh project from scratch and just use the web.config there. Copy all your 3.5 pages in there and manually move over web.config elements that you need. The pages themselves don't require any converting, it's all in the web.config. The web.config for a .net 4.0 page is actually significantly smaller due to the fact that .net 4.0 is not just an extension of .net 2.0 like 3.5 is.

ASP.NET development server unwilling to upgrade to .NET 3.5

I had an ASP.NET 2.0 web project. Worked fine. I decided to upgrade the site to 3.5. The upgrade worked fine. I have added a IHttpHandler that required to include the following line in the web.config:
<add verb="GET,POST" path="MyOperation.asmx" type="MyClass"/>
This line in the web.config generates the following error: "Parser Error Message: Could not load type 'MyClass'."
This sounds like a typical spelling error in the class name. But it looks not, I checked it 1000 times. However, what is really strange that on the bottom of the "yellow-screen-of-death" page it says:
Version Information: Microsoft .NET Framework Version:2.0.50727.3082; ASP.NET Version:2.0.50727.3082
This is really strange. The project is set to 3.5. The only piece of code that use 3.5 features are the IHttpHandler implementation. All the rest of the web project are 2.0 compatible and works without problem if I exclude the line from the web.config.
Why is this?
[I did not try with IIS. I use ASP.NET development server.]
[EDIT] I have to apologize, it was stupid spelling issue as I expected in the first round. My IHttpHandler implementation was in a nested class and the proper class name is "OuterClass+NestedClass" vs OuterClass.NestedClass that I used in my config file. However, I thank to all who contributed because I learned new things on CLR versioning!
I think you need to use the fully qualified type name.
Like:
<add verb="GET,POST" path="MyOperation.asmx" type="Your.Namespace.MyClass, assembly.name"/>
and the error containing the version information of 2 is normall since the CLR hasn't changed for 3 and 3.5. the only changes were additional sepperate assemblies and syntactic suggar (like automated properties are a feature of the compiler not the runtime) ".net 4" will come with a new CLR.
The version is not an issue ( I think). .net 2 to 3.5 sp1 use the same run time. The newer ones are just new libraries and compilers. So from the asp.net point of view not much has changed.
ASP.NET 3.5 is really 2.0 with extra extensions. So, as long as the server has 3.5 installed, then the message that shows that you're pointing to the 2.0 framework confirms that you have it setup correctly.
The issue is likely what olle suggested, that you need the full class name, assembly name.
Also confirm that you have the dll in your /bin folder and that it's marked as an application if you're not working from the root of your site.
Go to the project properties. Choose the Application tab. Change the Target Framework to .Net Framework 3.5 if you haven't done that already.

Running an ASP.NET 1.1 application under 2.0

I have an application written in ASP.NET 1.1. If I switch IIS to use 2.0 what issues am I likely to see? Initial tests have thrown no problems, but I was wondering if anyone had experience of running ASP.NET 1.1 applications under 2.0 and could maybe point out some areas to watch out for?
Thanks for any advice.
Just make sure that you are not running different web applications in the same application pool if they require different versions of the .NET framework.
Create separate app pools (at least one for each version of the framework).
Maybe also have a look at this blog post by Brad Abrams about breaking changes between .NET framework 1.1 and 2.0. Here's a short quote :
...we work very hard to ensure that
your V1.1 apps will this just work on
2.0, but none-the-less, this doc is likely worth a quick scan as you
migrate to 2.0
When we migrated our 1.1 applications to 2.0, I don't think we had any problems. There were a handful of cases where the compiler warned us that we should use a different (updated) assembly, but other than that everything was fine.
Most ASP.NET 1.1 applications will run just fine under ASP.NET 2.0. One thing to watch though is that you don't run an ASP.NET 1.1 and an ASP.NET 2.0 application in the same application pool.
The biggest problem we had was connected with the insertion of the xhtmlConformance element in the web.config file connected with javascript libraries, removing it worked fine for us
check this post from Scott Gu.
Usually asp.net 1.1 application migration to 2.0 does not raise any issues. You might need to change the location where you put the class files.
You will see some warnings, some deprecated method call etc.

.net 3.5SP1 on a .net 3.0 Server - Is it possible to use the /bin Folder in ASP.net?

One of my Websites is on a Shared Hosting Provider, running either .net 2.0 or .net 3.0, but not 3.5 SP1.
I wonder if it would be possible to still use 3.5 SP1 by simply deploying all the 3.5 assemblies into the /bin Folder, since technically it's all still the 2.0 CLR.
I know that if my Host ever updates I have to remove them or else weird stuff can happen, and that I am driving into Unsupported-Territory at full speed, but is there any really big road sign that says "DON'T DO IT!" or even "That is not possible because of X"?
Primary reason is because I want to use ASP.net MVC and possibly ADO.net Entity Framework, but I do not want to make a contract with yet another Hosting provider.
Thanks!
In theory it can be achieved, but it's definately not recommended.
Scott Hanselman did a post on how to run ASP.NET MVC onto a server with other .NET 2.0 installed, see - http://www.hanselman.com/blog/DeployingASPNETMVCOnASPNET20.aspx
It's very much a "works on my machine" certified post though.
All DLL's on an ASP.NET site can reside within the /bin, provided they are correctly referenced. My suggestion - create a virtual machine (MS Virtual PC is free), install just .NET 2.0/ .NET 3.0 and then copy the DLL's you require from a .NET 3.5 install (tip - you'll find the DLL's in %program files%\Reference Assemblies).
I take no responsibility for the damage you cause to your provider from this answer
I'm pretty sure you can't do this, but googling on the following blogs may get you the definitive answer:
ScottGu
ScottHa
BradA
The problems would be, I think:
You want to load system.dll. Where does it look? does the GAC take precidence? (I think it does), therefore you get 2.0. So you have system.dll v2.0, and you try to use a DLL (eg system.web.mvc) which is bound to system.dll v3.5, but is only in you /bin.... it should explode loudly, not having the same contracts and the like.
Personally, I wouldn't try it, especially on production. But if you can take the site down for a while, give it a go. Worst case, you have to delete the files and re-upload the old site.
YMMV :)
I've successfully run some EntityFramework websites on hosts that only had .net 3.5 installed. I copied the System.Data.Entity.dll and the System.Web.Entity from Program Files%/Reference Assemblies. I also had to modify my web.config and remove the references to the System.Data.Entity and System.Web.Entity.
Update: this technique will not work for DynamicData or the EntityDataSource web control. I belive it has to do with the System.Web.WebExtensions.dll which already exists in the GAC from 3.5

Resources