How to properly set up Application Pools for IIS6 - asp.net

I am really stuck with this Parser Error Message telling me "Could not load the assembly 'App_Web_amlohswi'. Make sure that it is compiled before accessing the page." I have been looking around for a few hours checking different posts here and googling information. I have found out that I need to set up a new Application Pool that runs .NET 2.x.
(On a side note, my app is being developed in .NET 3.5, is there a way to set it up to use 3.5 instead of 2.x?)
Can someone provide me with a good explaination on how to set this up properly and (optionally) why is it necessary?
I am more used to developing in PHP so I am used to edit src >> upload >> success!
Thanks!

ASP.NET 3.5 sites run in 2.0 app pools as long as that version of .NET is installed on the system.
You may have to set up web.config properly. Visual Studio should do this for you when you create a new project.
You should also make sure you don't combine 1.1 and 2.0 applications in the same app pool. Try putting it in a separate app pool and see that helps.

Since #Trull provided you with a link to the "how", I'll chime in with the why.
.Net 3.5 just builds on the base .Net 2.0 libraries so you don't need to set it up for 3.5. .Net 2.0 and .Net 1.1/1.0 share some of the same name spaces and classes and therefore you need to choose which set of libraries you want to use with your application. Since your application uses the libraries from .Net 2.0, you need your app pool set up to load these libraries for your application rather than the .Net 1.1 libraries. You will also need .Net 3.5 installed on the web server, even though you only configure the app to use the (base) .Net 2.0 libraries.
This would basically be the equivalent of different versions of PHP. You would expect an application written using PHP 5 (and taking advantage of constructs in PHP 5) to work with a PHP4 interpreter. You'd need to upgrade to the newest interpreter (or at least choose the newer one if both are installed) before your app would work. It's the same with .Net -- you need to choose the right version, the version that your code expects to reference before it will work.

Here is how you use 3.5 in IIS. All hail Hansleman!

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.

.NET Core 5.0 Console with WebAPI

I once build a .NET Core Console App that contained a web host, so I could make controllers without using IIS. Isn't that possible in 5.0?
I need it to run as a service later. It used to be so easy :-)
I can't find any guides to that, but I can find guids addressing version 2.1.
Latest .NET Core project templates (and .NET 5 ones) use Kestrel by default.
You can find the related documentation here.
You can also find here specific documentation about running ASP .NET Core as a service in both Windows and Linux, and in the case of Windows, with and without IIS.

.Net 1.1 upgrade to .Net 2 - Does it still use the .Net 1.1 framework

We have recently taken on support of a web application that was written many years ago and targeted v1.1 of the .net framework. It runs on Windows Server 2003/IIS 6 environment.
After looking at the configuration of the site in IIS the target framework is set to 2.0.
Given that extended support for .net 1.1 will cease in October of this year (http://support.microsoft.com/lifecycle/?p1=1249) I am trying to ascertain whether the site will still use any of the .net 1.1 framework assemblies given that the application is built and compiled in Visual Studio 2003.
I am assuming this is the case because although ASP.net 2 is set as the target framework
in IIS (and therefore the aspet_isapi.dll invoked is the .net 2 one etc) the assembly is a .net 1.1 assembly and will therefore still use the 1.1 framework. However, is this assumption actually true?
The website only has another year or so to live before being replaced by a new solution entirely so I would prefer not to upgrade it if possible and run the risks such changes bring with them.
However, we obviously can't run something on an unsupported version of the framework if any element of if that framework is actually being used.
Any thoughts would be appreciated.
Update:
It would seem that .net 1.1 is a core component of WS2k3 so you can't just uninstall it. I could have attempted to remove the ASP.net component but I don't think that would fully uninstall everything and given that the dev environment is shared I can't risk causing any issues right now.
However I have previously set everything up on my local machine (Windows 7/IIS 7), so I changed the application pool to point at .net 2 (it was already running in classic pipeline mode), uninstalled .net frameworks 1 and 1.1 and cleaned up the files left behind afterwards.
The result was that the site ran absolutely fine, which would suggest in an IIS 7 environment at least that I don't need to worry about upgrading given we are running under .net 2 within IIS.
It's not an ideal test as it isn't a mimick of our live environment. I'm going to post a question on MSDN and asp.net to see if any Microsoft folks can add anything more definitive. I will post back here with any updates.
Just because official support will end doesn't mean Microsoft will pull the plug and force an uninstall of .NET 1.1 via Windows Update. It only means that:
if a gaping hole in the framework's security is ever found, they'll not fix it;
There won't be redistributables for the next versions of Windows, and the next version of IIS won't run it.
So the application will still run in a year. If you leave the server alone, the application might run until the machine breaks of old age.
So my suggestion is relax, and focus more on the new solution.
I got the answer to this questions after reading this link (provided as an answer to this question on the ASP.net forums)
http://msdn.microsoft.com/en-us/library/ms994381.aspx
Under "Application Load Mechanisms and Possible Issues" it states:
By default, an application built using the .NET Framework will run using the version of the Framework it was built against if that version is installed on the computer
It then goes on to detail (for .net 1.1 and 2.0 at least) when a particular version of the framework is used.
Essentially, because our server has both 1.1 and 2.0 installed the application will still be using version 1.1. If 1.1 was not installed then it would run by default under 2.0, which explains why the web application still worked after I uninstalled .net 1.0 and 1.1 from my local machine.
Given that the live server is W2K3 and I can't remove .net 1.1, I will be rebuilding my application to target .net 4.0.

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.

Upgrading ASP.NET from version 1.1 to 2.0 - Any Gotchas?

I know we are really behind the times here, but we are just about to upgrade from .NET 1.1 to .NET 2.0.
Thank you for your sympathy.
Anyhow, are there any gotchas we should look out for?
Do you have any general advice before we jump in?
Please do not post telling me to go straight to 3.5: 2.0 is all we're allowed!
We're using mostly C#.
Yes. The most important thing for you to know is to use a Web Application Project, not a Web Site. Web Sites use a totally different compilation model and migration is pretty much a disaster. Web Application Projects are much more similar to how things worked in 1.1.
We also had an intermittent problem with redirecting from the login screen, but according to Google, we were basically the only ones who had that problem - we've since resolved it.
Most of the other problems we ran into were small and easy to navigate, and the overall experience was a net improvement.
Here is my recommendation before upgrading:
If you are used to use Visual Studio 2003, you will need to go for VS2005. You will have to convert the old solutions and projects so that it will be compatible with VS2005. Make sure to have a backup of the project you're going to convert so that you can roll back or even use it as source for any modification you may need to the converted projects.
If you're developing web applications using .NET 1.1, make sure that all the virtual directories and applications in the IIS is configured to work with ASP.NET 2.0. You may need also to configure a new Application Pool for your .NET 2.0 applications.
If you're using any third party libraries in your .NET 1.1 projects, you may need to confirm its compatibility with .NET 2.0 projects. Some old libraries used in .NET 1.1 are not compatible with 2.0.
One gotcha is home-grown 1.1 implementations of .NET 2.0 stuff (that was missing in 1.1) like RegistryHandler and so forth. Sometimes your newly-ported 2.0 code will look like it's properly using a 2.0 class when it's really using the home-grown version.
Deployment is another gotcha, if you're upgrading an already-deployed app. You have to switch the .NET version in IIS from 1.1 to 2.0.
I remember we had to change some client scripts, because the way ClientIDs are generated for server controls changed from ASP.NET 1.1 to 2.0.
I don't remember the exact circumstances, but some IDs which previously wer prefixed ctl0_ became ctl00_...

Resources