开发者

.NET web application automatic update pull-style

I have several .net web applications that use the same cms-like framework. When I add new f开发者_如何学JAVAeature to this core framework I want each application to be updated with this feature. So basically I need to do the following steps:

  1. Put App_Offline.htm in the application root
  2. Copy files that have changed from the update server
  3. Run SQL update scripts if needed
  4. Remove App_Offline.htm

I read about CruiseControl and other continuous integration tools, they have features very similar to what I need. The problem is that they use push-style update so that integration server builds source and then copies files to production servers. I can't use this approach because my clients can't give me access to their production servers. So what I need is to have a "Update" button in the IIS manager or anywhere else so that client can click it and it pulls data from the update server. Does anybody knows if there is a solution to achieve this?

Thanks


The approach I took was to create a script that pulls the latest deployment version from git, stops IIS, copies the new version over, starts IIS. Its very crude but if the only thing in your git repository is the latest deployable version it will work.

I even setup the publish button in Visual studio to copy to my local git deployment repo. Then I just push from my dev machine and I run my deployment script on my target web servers which pulls the latest version.

The SQL update scripts part of your question is interesting. It sounds like you need something akin to db migrations in Rails. This is not something I have had to deal with yet but I will point you here: http://www.infoq.com/news/2009/01/migrations_dotnet


I see this as application subsystem which perform some steps:

  1. Routine that checks the application latest version
  2. Perfom a download of the latest pack file
  3. Unpack and copy new files
  4. Call a sql command-line to inform all sql statments
  5. At the end, copy all dll files to bin folder

There are other way to it, but this works safe and sound as pattern.

To update the bin folder from within ASP.NET, your IIS needs to allow access to your bin folder. So you may consider adjust your environment security by creating a custom permissionSet like this:

<IPermission   
class="FileIOPermission"   
version="1"   
Read="$AppDir$"   
Write="$AppDir$"   
Append="$AppDir$"   
PathDiscovery="$AppDir$" /> 

So that you can copy work out files into this special folder.

References

  1. http://msdn.microsoft.com/en-us/library/ff649312.aspx
  2. http://msdn.microsoft.com/en-us/library/ms998341.aspx

ps.: If you find problems with the bin folder. Copying new versioned files to GAC and manage the assembly reference into web.config version. Sounds good too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜