We have a 2.x ASP.NET application, running on Windows Server 2k8R2.
We had to make a couple of changes and when we posted them to production the new changes are not working. When I check the physical page on the production server all of the new code is there, however the old code is still executing.
Something seems cached and I don't know where to check to un-cache it? I quickly restarted IIS but I can't bring server down for a long period of time until later tonight. I would like to figure out why this is happening so I can reset it now and also avoid it in the future. Any idea?
It's the same as refreshing the application pool. Do that instead, it's much faster!
I don't know what is causing the problem but I did find a fix. When I touch the web.config it recycles everything. So I edited by web.config, just added some black space and saved it. Once I did this my page refreshed properly. This allowed me to keep running the server. If I edit web.config multiple times it will lock up and I'll have to restart IIS (learned this the hard way a while back) but for a one time update so I can keep running until I can recycle later at night, it worked great.
Related
I'm a beginner in ASP.NET 2.0.Probably this could sound too basic and stupid issue for someone expert in the ASP.NET.But this is giving me sleepless nights.
Basically i have developed a simple multilingual website with a master page and content pages which fills inside the content place holder portions of the master page. The application works great when it is configured to run on the ASP.NET Development Server 2.0. But once i publish it to run on the IIS web server it will no longer function. :( I could see from the trace that none of the session variables i use are stored and redirected to the relevant content pages.
Although the contents are displayed, the session variable values by which i take some decisions on the redirected pages are lost and i run into exceptions.
Please guide me where am i going wrong and exact procedure for Publishing an application.
Ex: my home page has URL which runs something like
http://localhost/Onlineupdate/Home.aspx?vers=1.1&lang=fr-FR
Based on the above URL, i strip and save the vers and the lang variables in a Session variable. However these are lost when hosted on IIS.
There are a dozen or so things that could cause the session data to be lost:
IIS restarting
The app pool restarting
due to a change to the web.config
due to a change to anything in the \bin directory
memory limit reached, or a bug causing the app pool to reset.
several other possible causes
Your host is actually a web farm, and you're using in-process memory, which will cause issues when one server fails over to the other, unless you're using SQL Server session state mode.
Since we don't have enough information to answer exactly what's happening in your specific situation, I'd ask you to start by reading up, starting here: http://msdn.microsoft.com/en-us/library/ms178581.aspx
Edit: I did find this blog article, which may be helpful: http://blogs.msdn.com/b/amenon/archive/2007/08/21/troubleshooting-session-loss.aspx
The following is not necessarily part of the answer, but added to try to be helpful.
If it's feasible, from my own personal experience, we've had success in eliminating our lost session issues by using the SqlServer Session State mode. Since we implemented this, our session issues have all but disappeared.
also i found the main problem that you should initialize session before use
like:
session[“id”]=””;
and after that it well work fine
In order to prevent this to happen first in the web.config set restartOnExternalChanges to false.
Now in web.config changes must be propagated manually(this means that the dev is now responsible to build a mechanism for config change propagation).
Hint: You can use file watcher for this that will listen for the web.config (or any config you use in you web. app) for changes and wrap it as a watchable configuration so you can reload the configs when they are changed.
Hope this helps
I faced the same issue in my ASP.NET MVC website .
and i have resolve it by next steps :
open IIS Manager
go to the application pools
right click on the application pool which related to your website
click on "Advanced Settings"
set "Idle Time-out (minutes)" to be "20"
set "Maximum Worker Processes" to be "1"
Click Ok to close the window
these steps has resolved my issue.
If I make a change to the vb code in a classic asp page does the change get picked up automatically or is an iisreset needed?
Thanks
Quickest answer NO you do not need to reset IIS
Once the changed file is saved, the new code will run.
There's no need to reset IIS or build the project.
The ASP Script engine does maintain a cache of "compiled" scripts (where the results of parsing and tokenizing etc are stored. So that subsquent requests for the same ASP page can be processed more quickly. However the last modified date of the ASP file forms part of the cache identity of the cached page. Hence if the page has changed since the last request the cached item is dropped and a new one built when the next request arrives so it all works seemlessly.
So as the others very quickly said, you don't need an IISReset or even an App pool recycle.
It may be worth pointing out that as of IIS6 there are very very few circumstances where you would ever need to perform an IISReset. IISReset is massively draconian and high impact. Most of the time when such a "reset" is needed a simple re-cycle of the appropriate application pool will do which has a far more gentle touch.
Even back on IIS5 a close equivalent of a app pool recycle could be achieved with by restarting the appropriate COM+ application.
On Win 2003 Server (IIS6) most of the time, save the changes to the file and it works.
I have had caching problems when the files have been saved and then copied/moved to the final location which is a virtual folder in IIS.
For example:
Say C:\inetpub\wwwroot\myfolder\ is the physical path for the URL http:Myserver/myApp/
I save my files in C:\inetpub\wwwroot\test\ and everything works fine
Move/copy the files from 'test' to 'myfolder' overwriting existing files and when I access http:Myserver/myApp/ I see my old pages, not the updates.
I have a website that I'm hosting on a public IP using IIS 7.0. (using c# asp.net 3.5)
I find that if I navigate to the webpage for the first time in a day. It loads endlessly and nothing shows up. Then when I re-press enter in the address bar, it loads right away and everything works fine.
From then on, when I got to the address again it loads quickly.
I don't think this is a compilation issue as all my code is pre-compiled.
Any ideas what might be causing this behavior?
Thanks!
Andrew
I had a similar problem which turned out to be caused by the IIS app pool recycling.
In my case, the website had outgrown its hosting package and as soon as it hit the arbitrary memory limit, the app pool was recycled and the application restarted, recompiling on the first page view.
You can check for this by adding a Global.asax and handling the Application_Start event. You could write logs to a database or send an email notification with whatever debug details you want.
I also handle Application_Error which offered up some useful info.
If you notice Application_Start happening several times a day, you may have a memory leak or similar issue.
Normally, I use App_Offline.htm for taking the site offline. But occasionally, when I do that, the site just hangs (like in: browsers wait forever, server gives no response at all). This seems to happen on an updateable site when I change something, like a control and afterward, when it doesn't go quick enough (site hangs), I place App_Offline.htm in the root of the website.
In most cases, this immediately takes down my site. But occasionally it doesn't. In those cases, I cannot just stop the website (when I restart, the behavior continues). Stopping the application pool doesn't let me restart the same app pool. The only two solution so far is restarting the whole IIS web service.
I'd like to prevent this from happening. Is this a bug in IIS not "breaking all actions" when App_Offline.htm is found? I use IIS 7 with Windows 2008 SP2 64 bit.
What I found was that my web.config file either had an error in it or was missing. When this is the case, app_offline.htm does not get processed.
IIS should not stop existing actions, only prevent new requests from going through: Will app_offline.htm stop current requests or just new requests?
It sounds like you are describing a scenario where you update a control, try to load a page, and IE is stuck loading. At this point you drop the app_offline.htm and expect to see that page immediately.
If you are making a completely separate/new request after putting app_offline.htm in place then you should see the page come up. However the existing request will not be affected as linked above.
If possible try deploying the app_offline.htm file prior to making the control change.
I am not sure what you mean by "Stopping the application pool doesn't let me restart the same app pool"...if you meant that you can't restart the pool immediately after stopping it, thats because it isn't stopped yet. Depending on the number of Worker Processes in that pool it may take a min for it to completely spin down so it can accept the start command.
Also, I would think you would have to restart the pool in order for the app_offline.htm to work effectively anyway.
Here's the thing.
Everytime when you open the .sln at the server, or updating the code, it will create the app_offline ticket in the root.
This is the feature from asp.net itself to prevent any access to disturb your development.
Delete the app_offline manually everytime after you open the .sln.
hope this help.
thanks.
Another possibility is a missing handler. The following handler is required:
ExtensionlessUrlHandler-Integrated-4.0
To fix the issue you need to at a minimum:
Wait the length of your website timeout to ensure all requests have finished.
Background processes kicked off from a web request will mean further extending the length of time you wait beyond the website timeout
Unload any unmanaged code by hooking into the DomainUnload or Application_End events
I'm waiting 3 minutes for App_Offline.htm to take affect and this seems has allowed App_Offline.htm to work as expected.
I've got this problem.
I launched an ASP.NET website with the Umbraco CMS on an ISP.
(Its just a very basic informative site. nothing special.)
When I go want to visit the website however, the first pageload takes a lot of time, sometimes even up to 20 seconds. Of course this is ridiculous.
Afterwards, I am able to navigate the site relatively quick..
So every first pageload is slow, then everything is OK, more or less.
Does anybody have any idea what the problem could be? Would it be IIS? ASP.NET?
IIS is probably configured to shutdown the application pool after N minutes of inactivity.
AFAIK, this is the default behaviour on IIS.
If it is the first request to be served, IIS at least starts the APP Pool. This might take a bit of a time. Maybe Umbraco loads initially some data, but I did not have any experience with Umbraco, so that's beyond my knowledge.
-sa
What do you meen by first page load?
Have you just done a build? If this is a website then .Net will compile and load the dll. Then IIS will cache page outputs.
Do you have any large images on the page?
Essentially there are an infinate number of reasons. Have you used firebug? Determine where the loadtime is?
Do you have a link?
You may want to look into a keep alive service. There are many available that regularly poll you site to keep the application pool running and prevent the startup delay you are seeing. More information here and here.