I have several MVC4 sites on my VPS. They all have the same issue. They are so slow (up to 10 seconds to load, which is not a good first impression).
I am aware that when you first load your site, it will take a little while due to various things I've read upon. I understand this.
The problem is the following situation is true.
Publish MVC4 site to server.
Load MVC4 site in browser a PC. Site takes a while to load but expected.
Look at other pages on the site. A few are slow, but generally all is OK.
Close the website.
Reopen the website.
All pages respond well.
Close the website.
Leave it idle for 1 hour.
Open website, it is slow again, as if it's only been published
I can only assume it's something to do with the session, IIS or the app pool
In webforms I used to have tracing, I don't appear to have that in MVC and I don't know how I can debug such an issue.
That's actually the expected behavior, given that after a period of inactivity the application pool will recycle, to free up unused resources. Check the application pool's Recycle settings to configure that duration.
If you also want additional control on what happens during recycling there are a few options:
IIS7.5 (ASP.NET 4) supports a feature called "AutoStart", which can warm up your site after deployment and after recycling.
IIS8 has additional support through the Application Initialization Module.
Related
I completed a website using ASP Core 3.1. I uploaded this website via Plesk panel to the hosting. When I control the website's speed on different sources, I saw the website has very bad TTFB, over 5 seconds,
But this is only valid for the first entry to the site. I asked this issue my web hosting company. They said that it was from API or an external file, but I could not understand.
This is my observation.
When you don't access site for certain period of time , it will become ideal and most of hosting provider (shared hosting) unload that site and application pool.
When next time any request comes then it will take sometime to load application again. This will also happen if you upload new version of your application.
At IIS following configuration. (Advanced settings)
Preload Enabled ( Site level)
Start mode ( Application Pool Level)
Ideal time out ( Application pool level)
If you go for Azure Web App then there is a configuration in general settings like Always on.
Now comes to your application , like are you loading any data on first request from external server or so. If so that latency also cause such issue.
I want to display like an "under maintenance" page, while I restart (stop and then start) my IIS .net core website.
I want to do this, because I often need to replace some .dll's and I also want to tell the users, that the website is still active, just under construction for some minutes.
I need to stop the website, otherwise I'm not able to replace the .dll files.
Is there a good way to do this directly in IIS? Maybe also another nice way to do this, despite IIS?
You are maybe looking for app_offline.html
Placing this file into the root of the web app will cause stopping the app and serve that single file instead. I did use that with asp.net. First versions of asp.net core did not support it but meanwhile they should as the doc states.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/aspnet-core-module?view=aspnetcore-3.0#appofflinehtm
I have a Asp.Net Core MVC application running on Windows Server 2008 R2 with IIS. But every time I update this application, I need to manually stop the applicationPool in IIS, and restart the applicationPool after I finish updating the app. Otherwise it will tel me "the xxx.dll is in use by other progress".
Is there any way to make this process easier?
A workaround For Windows with no down time and I am regularly using is:
Rename running .NET core application dll to filename.dll.backup
Upload the new .dll (web application is available and serving the requests while file is being uploaded)
Once upload is complete recycle the Application Pool. Either Requires RDP Access to server or function to recycle application pool in your hosting control panel.
IIS overlaps the app pool when recycling so there usually isn’t any downtime during a recycle. So requests still come in without every knowing the app pool has been recycled and the requests are served seamlessly with no downtime.
I am still searching for more better method than this..!! :)
January 2022 - for Linux
For Linux, we use Openresty nginx with Lua script to hold (sleep) incoming requests for few seconds until the service running .NET Core or .NET 5 or .Net 6 application restarts and then we release the threads we had hold.
Refer: https://github.com/basecamp/intermission
Finally I found my anwser:
I just need add a file named app_offline.htm to the IIS web root(not your project wwwroot folder), and remove it after you replace all of your file.
due to this issue you may need try both App_Offline.htm or app_offline.htm .
and this will allow you to use FTP client to update
Opening the web.config file in an editor and saving it will cause the web application to reload, even if you don't change anything. All DLLs should be replaceable, until a user hits the site, causing the web application to start again. I sometimes use that as a workaround.
A more full fledged solution would be to use Web Deploy, either through Visual Studio or by command line. This can take a litte while to set up, but offers more automation.
https://learn.microsoft.com/en-us/aspnet/core/publishing/iis#deploy-the-application-1
There is no way to hotswap in place DLL's.
Your best bet is to deploy to a new folder each time (For example a versioned folder), and change the website directory in IIS once you have fully copied your website onto the server.
I've inherited a Silverlight/WCF application. (Having worked on .net MVC, and SPA for quite a while)
I tried switching the IIS website folder to see if a tweak to the code and a fresh build would work, it didn't work and I switched back and although the website is functional it has a number of faults.
For some reason the Windows authentication appears to have stopped working, this authorises a number of the admin functions. I think this is broken and so not enabling the functionality in the Silverlight app.
The server I've inherited has the applications as folders in the default website, which is new to me, and quite constraining. I've gone through IISAdmin videos, and learnt a lot, but not enough to fix the issue.
I am unable to get the software to run in VS2013, quite a bump after working on Single Page Applications.
I'm stumped as to how the same code put back no longer works; I've learnt my lesson, but I still need to fix the system. I am not sure whether IISReset would make a difference since the AppPool is recycled every 29 hours. I've found out what the harm in trying is, and so I am proceeding with caution.
So my main goal would be to get the Windows Authentication working again.
What exactly happens when we do IISreset? What resources get released? We have an ASP.Net website (.net 1.1) which use Crystal reports 11. Lately, running reports are throwing several crystal report specific exceptions and then the users can't run reports anymore. Resetting IIS lets the users log back in and run the reports until it fails the next time. Knowing exactly what resources are released when IIS is reset will help us dig deeper to find the root cause. Any help?
Pretty much everything. All thread pools, asp, asp.net, shared memory, etc... will all be purged. Doing in IISReset is basically the same as going to Services->WWW Service->Restart. Also, it will affect SMTP and FTP if you are running these services as well.
To narrow your problem down slightly ( and to reduce impact ), you should try putting your website in its own App Pool. Then when it next hangs, see if restarting the app pool fixes the problem. Then you are limiting things to just one running web application, not completely taking down iis. If the problem persists and still requires an IISReset, you at least have one more datapoint to work with.
EDIT: In response to your additional comment, I would suggest you do as much logging as possible and see if the problem becomes obvious. http://learn.iis.net/page.aspx/579/advanced-logging-for-iis-70---custom-logging/
Obviously, a quick run through Event Viewer is probably a good idea.