I suggest you ...

Take my site/app offline during publishing

Currently when I publish my site/app it stay's online. It would be better to drop an app_offline.htm during publishing so that my app doesn't behave in a funky fashion.

709 votes
Sign in
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)
    You have left! (?) (thinking…)
    Sayed Ibrahim Hashimi shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →


    Sign in
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      • Daniel Green commented  ·   ·  Flag as inappropriate

        I agree with Bertrand. While this proposed feature is useful, I would prefer to set a key (e.g. AppOffline) in web.config, which I could use to make the site appear offline to users but still allow admins in. At the end of the build, the AppOffline key could be set back to false...or perhaps this would be a manual step...

      • AdminSayed Ibrahim Hashimi (Admin, Microsoft ASP.NET Future Feature Feedback) commented  ·   ·  Flag as inappropriate

        Hi Steve, thanks for the comments. The blog post that I have is more targeted executing app offline with the integrated build+publish experience. If you are calling msdeploy.exe you can use the new -enableRule for app offline.

        We have not yet added support for this rule in our build/publish MSBuild targets. We have not done that yet for the following reasons:
        * It requires MSDeploy v3 on the server
        * It currently does not support a custom app offline file

        I am working with the MSDeploy team to get support for custom app offline files (the feature was implemented, but we had to disable it at the last minute due to a security concern).

      • steve-jansen commented  ·   ·  Flag as inappropriate

        Hi Sayed,

        Your blog was a huge help when I refactored my shop's packaging/deployment process for ASP.NET MVC apps.

        My understanding is that we should now use `msdeploy.exe -enableRule:AppOffline`, which seems to be one of the lesser known new features in Web Deploy 3.0.

        Is this feature request outdated now with this rule?

        I admit this rule works well for me, though I do wish I could deploy a custom app_offline.html in the root of the web content to customize the offline message rather than an empty HTML page.

      • Bertrand Le Roy commented  ·   ·  Flag as inappropriate

        app_offline.htm is a little too violent. When I publish a site, I can take it offline, but I have no way of testing whether it works before putting it back online. There should be a way to bypass app_offline.htm, so that the admin can do some basic testing on the newly-published site before bringing it back online.

      • Tlptr Tlp commented  ·   ·  Flag as inappropriate

        Server Error in '/' Application.

        The view at '~/Views/Home/Index.aspx' must derive from ViewPage, ViewPage<TModel>, ViewUserControl, or ViewUserControl<TModel>.

        Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

        Exception Details: System.InvalidOperationException: The view at '~/Views/Home/Index.aspx' must derive from ViewPage, ViewPage<TModel>, ViewUserControl, or ViewUserControl<TModel>.

        Source Error:

        An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

        Stack Trace:

        [InvalidOperationException: The view at '~/Views/Home/Index.aspx' must derive from ViewPage, ViewPage<TModel>, ViewUserControl, or ViewUserControl<TModel>.]
        System.Web.Mvc.WebFormView.RenderView(ViewContext viewContext, TextWriter writer, Object instance) +180
        System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer) +107
        System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +291
        System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +13
        System.Web.Mvc.<>c__DisplayClass1c.<InvokeActionResultWithFilters>b__19() +23
        System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +264
        System.Web.Mvc.<>c__DisplayClass1e.<InvokeActionResultWithFilters>b__1b() +20
        System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +176
        System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +329
        System.Web.Mvc.Controller.ExecuteCore() +115
        System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +94
        System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
        System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +37
        System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +21
        System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
        System.Web.Mvc.Async.WrappedAsyncResult`1.End() +55
        System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +31
        System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
        System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +23
        System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +59
        System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
        System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8836913
        System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

      • Sayed Ibrahim Hashimi commented  ·   ·  Flag as inappropriate

        @Bert in the next version of Visual Studio you will be able to create a transform based on the publish profile. So if you have a publish profile named "TestEnv" then if a web.config transform with the name web.TestEnv.config exists it will be invoked.

      • Bert commented  ·   ·  Flag as inappropriate

        I agree. Another suggestion is to be able to link a Configuration with a publishing Profile. In our environment, I use Web.config transformations to change the application database. I then always publish the Test configuration to the test server and the Production configuration to the Production server. With the current WebDeploy I have to make sure that I choose the proper Configuration in the IDE before I publish.

      • Sayed Ibrahim Hashimi commented  ·   ·  Flag as inappropriate

        @Benjamin, I agree. I'm thinking that if there was a file named app_offline-template.html (or smtg similar to it) and that is the one which gets converted to app_offline.htm. If there is none then just drop an empty file for the default message.

      • Benjamin Howarth commented  ·   ·  Flag as inappropriate

        It would be brilliant to be able to provide a project-specific app_offline.html, that way if you're using WebDeploy to manage multiple sites on different servers, you can maintain any "brand consistency" while any individual site is offline.

      Feedback and Knowledge Base