Can I copy an Asp_offline.htm file into an IIS website for a vendor?

Rod At Work 866 Reputation points

We're getting ready to migrate a SQL Server database from on-prem, to an Azure VM. There's a classic ASP.NET WebForms/MVC hybrid app, which accesses the SQL database. During the migration we want to make the website unavailable to the users. This is done, so I understand, by putting an App_offline.htm file at the root level of the IIS application. I've made an App_offline.htm file for this purpose. It is my responsibility to do this, while the Operations team migrates the database to the new location, and I adjust where the Web.Config file points to the new location. Then remove the App_offline.htm file.

The question I have is can I just copy the App_offline.htm file I created for this, to the root level of the web app? I ask because every tutorial and reference I've researched on this, discusses doing this as a part of the Visual Studio project. This is a third-party application. I do not have access to their Visual Studio project. My intended approach was to copy the App_offline.htm file I've created, to the root level of the web application in IIS on the server, then make sure it had all the same privileges as any of the .aspx files in the same location. Is that the proper approach? Are there any gotchas I need to be aware of?

This is currently running in a VM on-prem, with Windows Server 2008 R2 Datacenter. IIS 7.

Internet Information Services
A set of technologies in the .NET Framework for building web applications and XML web services.
3,385 questions
0 comments No comments
{count} votes

Accepted answer
  1. Sam Wu-MSFT 7,136 Reputation points Microsoft Vendor

    @Rod At Work

    The question I have is can I just copy the App_offline.htm file I created for this, to the root level of the web app?

    Yes, if you want to take a web application offline while you migrate a SQL Server database, in IIS and ASP.NET, you accomplish this by placing a file named App_offline.htm in the root folder of the IIS website or web application. The App_offline.htm file is a standard HTML file and will usually contain a simple message advising the user that the site is temporarily unavailable due to maintenance. While the App_offline.htm file exists in the root folder of the website, IIS will automatically redirect any requests to the file. When you've finished making updates, you remove the App_offline.htm file and the website resumes serving requests as usual.

    More information about how to take Web Applications Offline you can refer to this link: taking-web-applications-offline-with-web-deploy.

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful