IIS process recycle and session variables - iis-6

Is it a bad idea to setup a web application on client PCs with Windows XP (there are ten workstations), rather than on a server (Windows Server 2003).
I have an ASP.NET application, which has a memory leak and uses session variables. I believe that the session variables may be causing problems when the IIS process recycles. Is there any benefit of installing IIS on a server rather than on workstations?
I was debating to myself whether to ask this question here or on server vault. As my question references session variables I decided to ask it here.

If the problem is regarding session variables or a memory leak it really doesn't matter where you run it because the problem is in code, not in the platform.
The only possible benefit to running a problematic application like this on Windows Server 2003 (IIS 6) rather than on Windows XP (IIS 5.1) is that you can schedule recycles for the Application pools under IIS 6 and may be able to put a band-aid over the problem by recycling often and changing the code to store session out-of-process.
Bottom line - fix the code and run the application where it makes sense to run it.

Related

IIS can only support three instances of a Blazor server client?

I've download Visual Studio 2022 and tested the default Blazor Server template (Home/Counter/FetchData). In Visual Studio, IIS Express I can open as many tabs / instances of the application as I want.
When I host the default Blazor Server template in local IIS (Windows 10 Home 21H2, IIS 10) I can only open three instance of the application. The fourth will hang until the first is closed. I see someone has ran into nearly the exact same issue but there is no solution provided.
Anyone know whats going on? I don't understand why IIS Express can handle multiple instnaces but IIS 10 can not. Even Conveyor by Keyoti can support many many tabs compared to IIS 10.
Note: I notice SignalR has limitations on Windows / IIS of 10 concurrent connections, but I'm not even getting two.
Updates
Out of curiosity I tested it on Windows Server 2016 Standard and I can open hundreds of tabs.
I re-installed IIS on Windows 10 to make sure something wasn't wacky.
I've ensured WebSocket Protocol is enabled.
Windows 10 Home supports 3 concurrent connections at the same time, according to Microsoft.
Normal HTTP requests to IIS get process and response returned. So even if you manage to achieve 4 or more at the same time, IIS will work through the request queue and you may not have noticed that your request was slightly delayed unless your individual requests take a while to process.
However with SignalR, a persistent connection is maintained to the server. So if you open one connection per browser tab, and you have 4 tabs open, that 4th tab is going to hang indefinitely until one of the other page has its connection ended (by closing the tab, manually disconnecting via code, or refreshing the page).
I can't reproduce the issue, and I have tried to search some way to solve it.I will summarize a few ways below that you can try.
Try to install Websocket Protocol in your Win10. You can find it in Windows features.
Workaround: install IIS Express in Web Platform Installer.
Workaround: Try to deploy it in windows server, and check whether have same issue. I found some posts also mentioned it may related with OS version.
The solution was incredibly simple (maybe too simple?). Don't use IIS at all.
In Program.cs just before building the app I override Kestrel ports to listen on any ip (for now).
(Optional) I provide a custom SSL certificate in the UseHttps constructor so that it can be emailed and installed on iOS and Android devices.
(Required) Then I publish the applications to a folder and just run the .exe on the hosting machines.
Program.cs
builder.WebHost.ConfigureKestrel(opt =>
{
opt.ListenAnyIP(8000);
opt.ListenAnyIP(8001, listOpt =>
{
listOpt.UseHttps(#"Path to.pfx file", "password for pfx file");
});
});
Now Windows 10 Home can support as many connections as the hardware can handle at https://192.168.0.XXX:8001. Is this how Blazor Server is expected to be deployed within a local network? I don't understand how this overcomes the connection limit pointed out in masons answer. Please let me know in the comments if I'm missing something.

Deploying an application server to a server

I am building a client-server application, this is all running locally on my computer whilst I am developing the system. However, eventually I would like to deploy the server-side part of the application to a server to run 24/7, enabling client applications to connect and consume the service at will. What I would like to know is, when I come to doing this would I simply just install the server-side application on the server, hit run and that's it? That just seems... well not right (to me), is this the way it is done? or is there a lot more to it? I imagine there is, but I can't seem to find any content on this subject.
FYI - the server is a self hosted WCF application.
You'd want to take your program's executable, support dlls and config files and drop them into a folder. Then create a Windows Service to run the program; if you don't use a Windows Service, the program will only run while you're logged on, which isn't good. As a Windows Service, a reboot of the server will bring the program back online even if you're not logged on.
Here's a knowledge base article from MS on how to make a windows service.
http://support.microsoft.com/kb/251192
If you're program is compiled as a DLL, then create a small .exe program to run it (a wrapper) then deploy the program as described in the article.
Good luck.

Issue with Internet Explorer 8 and 9 and MVC4 Web Site running on IIS 7.5 on Windows Server 2008 R2

We recently upgraded an MVC3 application to MVC4 and .Net 4.5. The upgrade was done by creating a new MVC4 site and adding all the controllers etc back in, manually.
The site was deployed internally to a win2008 R2 64 bit server, on which we installed .Net 4.5.
When we browse to the web site with IE8 or IE9 the application works well for a while as we navigate through various pages, including standard views, partial views, popups, paged lists etc.
At some point we end up going to a page in the site (any page, complex or not) and IE8 and 9 both just sit there for a long time (usually 1-3 minutes and displaying the page loading progress bar) eventually they both show the page as requested. Often the same behaviour occurs on the following few pages and then magically comes right (for a while)
If we browse to the same web site in Chrome, Ie10, Safari, FF at there are no issues at all. If we browse to the web site with one of these browsers from the same machine while the ie8/9 are "loading" then we can still access the site quite happily without any issues.
A check of task manager memory and performance on the client, web server and database server shows almost no CPU usage and no increased memory usage while this is happening. It is almost as if the browser is just taking a tea break. Fiddler shows nothing unusual either.
It should be noted that as this is an SAAS application we are managing multiple databases through the same site and these are configured into the users session state based on an incoming url in the web site bindings. Having said that as far as we can tell, the session state is remaining intact. a) The browser does eventually return with the expected data, b) there are no recycling events recorded in the event log (in fact there are no events at all around the time this issue occurs)
Application pool is set to framework 4.0.30319, integrated, enable 32bit, max worker processes = 1
We reverted the web site on the server back to the original MVC3 implementation and still retained the .net4.5 install on the web server. This now exhibits the same fault as the mvc4 site.
We re-imaged the server to a state before the .net4.5 was installed, ran the MVC3 site and everything operated again as we would expect. Repeating the install caused the same problem again.
It is almost like the .net4.5 install on the server has caused some problems for the IE8/9 browser. Back to fiddler again, which shows different host headers for the different version of .Net, but that seems to be the only difference.
Whilst we would love to be able to tell the user's not to use ie8/9 that is not practical, so now we are completely stuck.
Any help / ideas will be appreciated. Thanks.

Out of process COM server works fine in the unit test harness but not in the real service

We have a WCF service hosted in IIS that currently calls a VB6 DLL to do part of its job. This works fine, but we can't deploy the service to a 64-bit target environment without configuring IIS to run it in a 32-bit worker process.
I am currently investigating ways around that restriction. Porting the VB6 DLL to .NET is not possible for various reasons, so I created an ActiveX EXE wrapper around the DLL in VB6, so that the service can run in 64-bit and the VB6 parts in 32-bit.
When I tested the service I got this error:
Type: System.UnauthorizedAccessException
Message: Retrieving the COM class factory for component with CLSID {9AE7303B-D159-43F6-B1A5-52D297581820} failed due to the following error: 80070005.
After some Googling I found that this is due to either:
Calling an MS Office component
DCOM permissions not being configured
NTFS file permissions not allowing read/exec access to the IIS worker process identity (ASPNET in my environment)
Of these:
Definitely not applicable
Also not applicable; I am not hosting the EXE in DCOM or COM+, just a simple COM out-of-process activation
This looks likely; however, I checked the permissions, and NTFS reports that the Users group (which ASPNET is a member of) does indeed have read/exec access to the file
I tried calling the EXE from a unit test fixture, which is executed in my admin-level account rather than the IIS worker process account, and it worked fine, so the error is definitely something to do with permissions. I'm not sure what to do next. Can anyone suggest things I can check?
My test environment is Windows XP / IIS 5.1
UPDATE:
The IIS virtual directory is configured for Anonymous+Windows access; the WCF service uses only Anonymous authentication, the Windows authentication is for the VS debugger. Task Manager reports that the aspnet_wp.exe process is definitely running in the ASPNET account.
I explicitly granted Read and Execute access to the ASPNET and IUSR_<machine> accounts on all the COM exes and dlls involved. This made no difference.
I explicitly granted Local Launch and Local Activation access to the ASPNET and IUSR_<machine> accounts on the relevant interfaces in the DCOM configuration. This made no difference either.
As I see it I have 3 options:
Keep trying to get this working somehow.
Go the whole hog and host the EXE in COM+.
Give up. Tell users that the WCF service must be configured to run in a 32-bit app pool on 64-bit Windows.
Your error is an Unauthorized access exception. Therefore, the problem is probably rights related.
You could check what the security context of the 32bit worker process is.
Also check your event log, they may be information there about what account is being used.

WCF Service VS IIS 7.0 VS IIS7.5

I got WCF Service with Fluent NHibernate. When I host it in in IIS7.5 on my development machine(WIN7) it works fine. Worker process shows the clear garbage collection indication of my app pool.
But when I moved to production, which is a Windows Server 2008 with IIS7, Garbage collection is not working, and the virtual bytes in worker process keeps on increasing and got out of memory.
The app pool is configured as Integrated .net 2.0. Has anyone experienced this, or is it a known issue with IIS7.0, or do I miss any settings in my configuration file?
I already tried with timely recycling but it did not have any effect.
Regards,
Pradeep
There are some references to garbage collection running less often on windows 2008 IIS7, than on a development machine, see for example: GC Not Running Often Enough on IIS 7 Application - Windows Server 2008
However, if you are hitting this problem your code is written in such a way that objects are left for the garbage collection to clean up. You should try disposing objects and suppressing finalizations, see http://msdn.microsoft.com/en-us/library/ms973837.aspx especially the code example at the end of the article.