ASP.NET version for IIS virtual directory keeps resetting from version 2.0 to 1 when iis is restarted - asp.net

I have an ASP.NET website that i want to deploy to IIS 6.0. When i set the sites ASP.NET version to 2.0, the setting reverts to 1.0 when IIS is restarted. There are two other ASP.NET sites on the same server whose version setting is being maintained across IIS restarts.
So this problem seem to be affecting only new sites being created. I'm just wondering if i need to re-register iis or what?

So, here's why: one of your apps runs .net 2.0, while another runs 1.0, and they are using the same application pool. App pools are designed to run only 1 .net version. Unfortunately, this restriction isn't validated during setup time, but errors happen on runtime.
So, check that. Create another app pool for one of the .net versions.

Related

Use full IIS during ASP.NET 5 / Core 1.0 development

I used to develop my web-apps using ASP.NET 4.x and host them in full IIS already during development, because:
1) I use multi-tenancy (site1.me.local and site2.me.local point to my app) and IIS express can't handle that AFAIK
2) Most of the times I do not need a debugger -> I just (re)build my app and refresh the browser - restarting IIS Express and the VS debugger wastes some time
Now I tried my first web-app using ASP.NET 5 aka Core 1.0 and I wasn't able to get it to run in full IIS to continue using my known workflow. I found out I can start IIS Express without debugging and just rebuild to solve #2, but #1 is still open.
Is full IIS even supported for ASP.NET 5 / Core 1.0 during development? If so is there some documentation on how to set that up around?
All documentation for full IIS I found is for publishing, but not for development.
You may actually not event want to use IIS in development with Asp.Net Core. Asp.Net Core has been separated from IIS and even in production IIS will only act as a reverse proxy passing requests to your AspNet.Core application. Asp.Net Core uses Kestrel as an application server and it is much easier to use just this during development. To get a similar workflow you had before you would use dnx watch/dotnet watch during development which will watch code files of your application and if any of the files changes it will stop the application, rebuild the project and restart the application. This is when you can refresh the browser to see changes (note that this is even one less step that you had before where you had to rebuild the application yourself).
It still should be possible to use IIS for development if you really need it but if you don't have a specific scenario that requires IIS I don't think IIS for development will give you any benefits.
The integration mode with full IIS has been changed several times (from Beta to RC1 and now to RC2), which messes up the documentation,
https://github.com/aspnet/Announcements/issues/164
You probably need to wait till RC2 is available to see the latest official steps.

Accessing Session after upgrade to .net 4.5

I am having problems accesing the session after upgrading a web project to .net 4.5
firstly, I had a functional .net 3.5 web forms project which I upgraded to .net 4.5 on my dev machine. This compiled and worked well locally
Secondly I modified the application pools on my dev iis server to use .net 4.0 in preparation for running the new code deployment
Finally I deployed my upgraded project to the dev web server.
The problem is that I am getting an error straight away where I am being told I need to enable session state to access the session variables.
Background:
I have a master page which checks for the existance of a session variable. I have put this code in the page_init event of the master page to ensure it runs before the page_load of the content pages etc.
This technique worked fine under .net 3.5 and works well under 4.5 on the local dev machine. But does not work on the iis server.
I have followed various threads telling me to set enablesessionstate=true in the config all to no avail.
Could it be that there is either a problem with .net sites runnning .net 4.5 on iis with regards to sessions, or am I missing something more obvious.
Please help as this is very frustrating
Well, I have no idea what was causing this?
I have fixed the problem by creating a brand new .net 4.5 project and importing assets / pages from my preexisting site.
Remarkably doing it this way caused no issue with the session after deployment to the web server, Very odd indeed. I can only assume that the project upgrade process that I initially used left some odd configuration in place which upset the server ???
Anyhow, have invested enough time in this now, thanks for taking the time to comment.

How to route request from one application pool to another in iis 6.0

I have got two web applications (separate virtual directories) residing in the DefaultAppPool on Windows Server 2003. My first application has got a link and when I click on it, the second application opens up.
Now I want to use different .Net framework for both web applications and for that in IIS 6.0, I will have to host them in separate app pools.
Now the question is - is it possible to host them in different app pools and keep the behavior intact so that if I click on the link in first web application, it can still open the second web application hosted in a different app pool?
Thanks in advance,
D
I think I've found the solution and it is simpler than what I actually thought.
Steps I took:
Create another app pool in IIS 6.0 on Windows Server 2003
Assign one of the web applications to this pool. So now I have two web applications in two different app pools. Currently both are having ASP.NET version as 2.0.50727
Change the ASP.NET version of one of the applications to 4.0.30319. So interesting fact to understand here is - in IIS 6, you can't set the .NET framework for an app pool. It actually assumes it from the first application in it and then applies it to all the web applications residing in this app pool
And it is done!!
It can be checked to list all the sites and which .NET versions they are configured to by using aspnet_iisreg -lk. Run this command from your .NET framework directory. For ex: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319
Both the sites with different .NET framework will be listed
Hope this helps.

Install ASP.NET 4.0 alongside ASP.NET 2.0 on IIS6

I've read where you create a new application pool, one for 2.0 sites and one for 4.0 sites. But there is no option I see when creating a pool to configure the framework.
My problem is I have several 2.0 sites running as the Default Web Site. I added a WCF 4.0 service under a new virtual directory and set the framework to 4.0. I also put it in a separate app pool.
Now, I can only get one working at a time. Either the 2.0 sites or the 4.0 site. I get:
It is not possible to run two
different versions of ASP.NET in the
same IIS process. Please use the IIS
Administration Tool to reconfigure
your server to run the application in
a separate process.
Is it possible to do this under IIS6 and Windows Server 2003?
To clarify: Each app pool binds to the .NET framework of the first web site that uses it, in order of application startup. That first site will run fine, but all other sites will be restricted to the same app pool. You need at least one app pool per framework version; and in my experience, the most robust setup is one app pool per application - this way, you can switch framework versions without worrying about other applications, and you can kill individual applications through task manager when the need arises.
The App Pools don't need configuring, just make sure the 2.0 sites are running as one, and the 4.0 site running as another.

Does asp.net setting affect classic asp (IIS 6 settings)

My company has some classic asp sites and developing new sites in asp.net, and everytime we create a new site in IIS 6 all the sites go down for a couple of seconds. So I'm thinking of changing the default value of the ASP.NET version to 2.x since that is what we're developing and I'm wondinger if these settings somehow affect the classic asp sites that are running on same IIS.
All of them are asp.net 1.1 versioned right now but we have to get around this all-sites-down everytime we add a new site to IIS.
Any warnings? Anything I need to know etc?
Thanks a bunch.
All sites reset when you change the version of a site. Therefore, it is a good idea to change the default to the one you add the most.
The default setting will not affect any existing sites, .net, classic or otherwise.
The only issues you may have is that you cannot run a 1.1 virtual app within a 2.0 site.
Also, you cannot run different versions in the same app pool. Therefore you should change the default app pool at the same as changing the default version.
As an aside, I have read of some command line options and other setting that mean you can change the version of a site without causing all of iis to reset. However, I have not managed to do this personally.
Running a classic site along site a .Net site in the same app pool should be fine and you shouldnt see any down time in the IIS when you upload a new version to the server.
You will find the server pause for a few seconds if you change the config of any app pool or if you change over the .Net version that is running in a site, all sites running in that app pool will be reset as the app pool resets.
My recomendation would be to create 2 App pools one for your new .Net 2.0 sites and one for the old classic sites, this will also help out if you are undergoing development as although unlikely it is possable to write code to complete crash the app pool.
The only thing to remembger is that each app pool as a small memory overhead about 3-5MB so if you nmake an app pool for each site and host a large number of site you can very quickly run out of RAM.

Resources