Reputation: 11722
I have an automatic deployment configured from my GIT
to Azure App
using Web Deploy
. Every time when new code pushed to the repo, build is started, then deployed to the Azure
with Web Deploy
.
The issue is that Web App
(ASP.NET MVC) continue to serve requests using the deployed code, and the file replacement doesn't really affect it. Even if web.config was changed. Basically, the only way I can force the new app to loaded is to restart it (or stop/start) manually.
here is my publishig profile:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<ADUsesOwinOrOpenIdConnect>False</ADUsesOwinOrOpenIdConnect>
<PublishProvider>AzureWebSite</PublishProvider>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>https://app-name.azurewebsites.net</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<MSDeployServiceURL>app-name.scm.azurewebsites.net:443</MSDeployServiceURL>
<DeployIisAppPath>app-name</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>$app-name</UserName>
<Password>...</Password>
<AllowUntrustedCertificate>True</AllowUntrustedCertificate>
<_SavePWD>True</_SavePWD>
<_DestinationType>AzureWebSite</_DestinationType>
</PropertyGroup>
</Project>
similar topic at msdn with no answer
Upvotes: 26
Views: 2051
Reputation: 2467
David has already shared his insights. There is an alternate way to tackle this scenario through the use of Deployment Slots. You can create a slot and then configure Auto-Swap to tackle this. This has added benefits of zero cold start and zero downtime.
See this for more info: Configure Auto Swap
Upvotes: 3
Reputation: 11613
Correct me if I'm wrong here, but what else did you expect? If the application is "running", serving request, then the assemblies are loaded into memory. If you update them you should reload the application to load the new assemblies. As far as I know there is no way to remove assemblies from an existing AppDomain. So you end up needing to create a new one (by restarting the application).
One simple solution is to deploy a app_offline.htm
file along with your application. If IIS sees this file, then stops responding to new requests, requests already in the system will be served, then the application will be stopped. For every new request content of the app_offline.htm
will be served. After you complete the deployment, run a simple script with WebDeploy e.g. using -postSync:runcommand=
in msdeploy
and just remove the app_offline.htm
file. The new version of the application will start up.
If you update the web.config
file, then the new config should be loaded automatically. But this does not mean, the application will be reloaded entirely.
If you have this issue with static files, then maybe HTTP caching is your problem. The files are updated, but clients (browsers) load them from the cache. See this question for more details.
Upvotes: 0