Application working when app pool refresh in ASP.NET - c#

App pool refresh issue
Application is not working if we do not refresh the app pool (in IIS).
Issue Background
When our ASP.NET application and database (Oracle SQL developer) was migrated to a new server, it started coming for the new app server and DB server before that in old database and application server, it was not starting up.
Our Investigation
We have started our investigation and created a logging table Before and after the Application Pool refresh in this procedure:
osspbs_dba.build_request_pkg.get_requests_sp(in_req_id => :in_req_id,
in_site_id => :in_site_id,
out_cur_requests => :out_cur_requests);
We found the it is throwing a database error while fetching the cursor
Ora-01861.
Later we have logged the parameter and found that when China user works the NLS_TERRITORY and NLS_LANGUAGE is logged in the database according to their session.
But after that when American user started working then NLS_TERRITORY and NLS_LANGUAGE still logging as CHINA and the error started showing up.
This issue is gone when we refresh the application pool on the application server.
Attaching the screen shot of logs:
At line number 15 REQ_ID - 65527 when I access it from my system after the issue came it is logging it as CHINA.
After the Application Pool refresh It is logging as American and working fine.
So in my investigation once this changes to CHINA then it is not changing for other users sessions who are based on America or other locations.
Note: connection pool size also increased in web.config.

Related

log4net and event logging suddenly stopped working on Windows service

I have a Windows service (c#, .net v4.5.2) that runs daily and is supposed to log errors to the Windows Event log (via System.Diagnostics) and errors plus progress information to the database (via log4net). Log4net is set to write "INFO" level.
Both logging mechanisms were working fine last time I looked, but last night the Windows service failed. I went to the d/b and event log and found that it hasn't written to either since 20th June, until it logged the automatic restart (to both logs) after it crashed last night.
Platform is a Windows 2012R2 VM in Azure. The service takes change-tracked SQL updates from a slave database, applies them to the master database, backs up the master and restores it over the slave, the log4net log is on the master. It's all been running fine, it just gave up logging.
Can anyone explain why it might have stopped logging to both log4net and the Windows event log?
The application server, domain controller and database server were all rebooted at the same time on the day log4net stopped logging. The likely cause therefore is that when the application server started up and the Windows service started, log4net was unable to connect to the database and shut down.
(Absence of Windows events probably a red herring - since the service was otherwise running happily without any errors, there just wasn't anything for it to write to Windows events.)

Session expired error on login

We have two windows servers for different environment where the applications are hosted on IISv6.
I host a new site on server one .When we try to login to server one, application through exception SESSION IS GETTING EXPIRED immediately on login button clicks.
We have same binaries on server two and its working fine there.
One more surprise is that same application was hosted 2-3 months earlier and working fine on server one.
The works that I did:
I compared IIS setting on both server.
Re-host website for 2-3 times.
Clear cookies on browser.
Play with session timeout and execution timeout.
Authorization is also enabled for anonymous.
Both server and client machine time are the same
I would like to know, if someone faced the same issue here.
Thanks

MVC4: Application pool keeps stopping

What are the reason for the application pool to be stopped? I am asking about stopping the application, not recycling.
Does reaching private byte memory limit is one of them? When I debugged my website, it seems that the application pool is keep getting recycled at every minute, then suddenly the application pool is stopped and giving me
Error 503 unavailable.
I found out that actually my hosting provider degraded my private byte memory limit from 500MB into 100MB and without telling me. My application has minimum requirements of 150MB-200MB private bytes limit.
I am here asking this to make sure that the problem was because the memory limit, not the other thing.
It could be that the user identity is outdated, especially if you've tried starting a stopped app pool and the next request again fails.
In IIS, go to the Application Pools under the Server, then find the correct Application Pool for your web site, and click on it. On the Advanced Settings menu to the right, select Identity and change it and enter new user and password. Click on your Application Pool again, and select Recycle to restart it.
You can also try looking at the error message in Event Viewer, under Windows Logs, Application, Details tab.
Taken from HTTP Error 503, the service is unavailable.
I was having this same issue and I couldn't find anything in the event log location that MD GHOUSE mentioned. I ended up finding a warning in Event Viewer --> Windows Logs --> System that stated that the identity in my application pool did not have batch logon rights. I am adding that user to the AD group to resolve. I hope this helps someone.
try going into the IIS and selecting the application pool that is stopping. Click on advanced settings and go down to identity. Change the item from Application pool to Local Service. Restart the application pool or IIS and problem should be solved.
In my case, its due to domain password reset. When I created the application pool, I've used my old password. But after I reset my password, then application pool was getting stopped until I go and use my new password in the application pool advanced settings.

Session lost in few seconds randomly

My web application is developed using Dot Net 4.0 C# and MS SQL 2008 R2. Application and Database are deployed on separate servers.
I have used form authentication on my application and user session is maintained in Session object. Recently the session object on my application was getting lost frequently because of no reason.
I've tried below stuffs to fix this, but nothing worked.
Increase the session timeout from web.config
Increase the IDLE Timeout of Application Pool from IIS
Set the number of Worker Process to 1
Proper exception handling for required method and global exception handling
Fixed all exceptions and memory leakage.
Because of some other reason we've restarted our SQL Server Machine today and everything started working perfect now.
I'm confused now on how can a InProc session issue be solved by restarting SQL Server machine.

how to keep running C# application after windows log off

I wrote a C# application using RESTful web services. This application should interact periodically with our server application. I want this program to keep running in the background even if the user logs out of the computer. How can I do this in C#?
If you don't want your application to stop when the user logs out, then the application can't be running in the user's session (really a WinStation). That implies your app needs to run in a different session. The sessions that don't logout are service sessions. Run Task Manager and add the Session ID column, and view all processes, and you'll see what I mean.
So your application needs to run as, or be launched by, a service.
In addition to the first answer don't keep the service running under the specific user account. If you do so then also it won't work if you logged off.

Categories

Resources