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.
Thanks for the suggestion, we’ve implemented it in Web Deploy 3.0 and Visual Studio 2013 (and VS2012 with the Azure SDK)
For more info see my blog post at http://blogs.msdn.com/b/webdev/archive/2013/10/30/web-publishing-updates-for-app-offline-and-usechecksum.aspx.
Vipin Balakrishnan commented
This is a very good idea in msdeploy
Daniel Green commented
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...
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).
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
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
bu hatayı cözemiyorum
Tlptr Tlp commented
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>.
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.
[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.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +264
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.ControllerBase.Execute(RequestContext requestContext) +94
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
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.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
would definitely make deployment easy
Linda Mickelberry commented
Gareth Bradley commented
Definately a good idea.
Sayed Ibrahim Hashimi commented
@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.
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.
Tien Do commented
Agree, I also want this feature in next version of MSDeploy.
Chris Hurney commented
Agree with Benjamin Howarth
Sayed Ibrahim Hashimi commented
@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
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.