I'm building a site and for the moment, when I want to put it on the web server, I to go Build > Publish WebSite to a local directory and then on the FTP, I delete the whole existing content and then upload the new fresh content that's on my local directory. In the Publish Web Site popup, I see that there's an option for "Allow this precompiled site to be updatable".
If I make changes to some files in my AppCode directory, how do I update the server WITHOUT essentially shutting it down?
Thanks.
Unless you're using a precompiled site or a web application, all "regular" websites are updateable -- App_Code as well as content.
Precompiled sites can be made to be updateable, but I believe only for web pages, not for code files.
If you have a busy site with lots of updates it's possible that updates can break things until they're complete. You can work around that by creating a file called app_offline.htm at the top level of your site. That will effectively take your site offline as long as it's there. The contents of the file are sent to users instead of your active content, such as *.aspx files. When the update is complete, then remove the file.
Try to take a look here: http://msdn.microsoft.com/en-us/sync/bb840038
All that you need is a Synchronization between VS and server.
Related
We have hosted our site that use Mvc application in IIS. We are frequently making some design changes in CSS and Scripts files. So frequently publishing the changes in IIS.
But in client side CSS and Scripts changes are not reflected since its coming form cache. It makes our clinet to hard refresh to get the updated changes.
Is there any way we can do in IIS or hosting machine while publishing, that force to client browser to reload the CSS and Scripts.
Like cleaning the temporary files in IIS or any other way.
Regards,
Karthik.
Currently, in order to push my website live I upload files to the server via FTP using FileZilla. If a user reloads the site when I'm pushing over the website DLL, they'll get a File is being used by another process type of error.
Are there any better pushover techniques I can make use of to get around this issue or any techniques that are generally better than using at FTP client to upload my site?
You can always upload an app_offline.htm file while you are deploying the new site. If you do this in an asp.net application the user will be directed to the app_offline.html file no matter what page they try to load/reload. When you're ready for them to access the site again you simply remove/delete/rename the file (i usually just rename it so it's a simple rename to get the site back into offline mode).
http://weblogs.asp.net/dotnetstories/archive/2011/09/24/take-an-asp-net-application-offline.aspx
I need to ensure that when some individual pages are updated/modified, the time required to load the other pages to the Web site remains unaffected.
A. Create the application as a Web site project.
Copy the entire application to the deployment server.
Copy only the updated files to the deployment server when a page is updated.
B. Create the application as a Web site project.
Pre-compile the application by using the update able option.
Copy only the updated files to the deployment server when a page is updated.
is Pre-compile option available for web site or its available for web app?
I can simplify this question by some ifs that contains your answer.
If you update just the ASPX files and rarely you change the code files : then
Use Website and publish it using
Allow this precompiled site to be updatable
Using this option you can change ASPX files
Use fixed naming and single page assemblies
Using this option you can change code files, and replace them with their friendly name
Update required published dlls and ASPX files when ever you need.
Note: any changes to bin folder contents may cause application restart and that means all sessions will be lost, so in this case you must consider using other session state modes like SQLServer and StateServer and once you do you need to annotate all your session classes with Serializable attribute
If you will update just the ASPX files : then
Use Website and publish it using
Allow this precompiled site to be updatable
Using this option you can change ASPX files
Else if you just need to update the ASPX HTML content : then
You might reconsider your application scenario
because you need to use data-base to rectify the update problem as any body else do
And finally if you will update web-site code-files very rarely or your changes are at application level rather than page level : then
Use web-application build or publish it if you like.
Using this option you still have the ability to change the ASPX files
we have a asp.net 2.0 website created in visual studio using asp.net website model. So, every time I need to deploy the website to the production server, I go to visual studio and right click on the website and select "publish website". I will check the first 2 options. "Allow this precompiled site to be updatable" and "use fixed naming assemblies". In the Target location, I specify the folder name in my local machine. Once it is published successfully, I copy the contents from the local folder to the website folder in iis. Does this mean that I am precompiling the website. After copying the website, I don't see instant response to the pages. Initially it takes some time to load as if it is compiling at that time. After that, If I go to the same page again, it is fast. So, I don't think I am doing precompile but I am not sure.
Please let me know.
When you choose option "Allow this precompiled site to be updatable", it means that only code files (including code-behind) gets compiled. The markup (aspx, ascx, ashx etc) does not get compiled at all - that get parsed and compiled at runtime only on first visit. On plus side, you can make changes to your aspx/ascx files at deployed site and changes will take effect on next visit (due to re-compilation).
If you don't choose above option then all files will get compiled at publishing time and you won't get performance hit that you are seeing on first visit. However, for any change, you have to re-compile/publish the entire site. See this link to understand these differences.
I think this MSDN page can give you more information about the "Alllow this precompiled site to be updated" option.
http://msdn.microsoft.com/en-us/library/377y0s6t(v=vs.80).aspx
I have to implement ability to show "site is under construction" page during doing some maintenance work on site. There are a lot of ways to implement such behavior (using global.asax file, using IIS and so on). So I would like to know waht is the most used ways of impletenting this feature.
Thanks in advance.
I prefer App_Offline.htm file in the root.
Take a scrape of your site template, stick it in the App_Offline.htm file and place a message in it. Just dropping this file in the root folder of your web site effectively disables your site.
Meanwhile, upload/manage a second instance of the web-site using a temporary domain/URL and when tested/ready, re-point the old site to the new site in IIS.
The change you're deploying now is a simple change to a single page. But sometimes you deploy larger changes, or you deploy both code and database changes, and the site might behave incorrectly if a user requests a page before deployment is finished. To prevent users from accessing the site while deployment is in progress, you can use an app_offline.htm file. When you put a file named app_offline.htm in the root folder of your application, IIS automatically displays that file instead of running your application. So to prevent access during deployment, you put app_offline.htm in the root folder, run the deployment process, and then remove app_offline.htm after successful deployment.
Source: https://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/deploying-a-code-update