Build an IIS Website Using Rake

I use rake and albacore to create my .net ASP MVC project , however, one part that I still haven’t been able to automate is deploying the embedded project in IIS. Currently, on development machines, I force developers to manually create sites and link them to the released output folder generated by the assembly.

However, now that we have our installation of the CI box (Teamcity), I need to automate the setup of the website in IIS, so are there any rake tasks that can create the website in IIS? I remember how I saw him a while ago, but I can’t find him.

I can install IIS 6 metafiles (I don’t remember its exact name) and any other iis plugins currently in the IIS 7.5 kernel.

== Edit ==

The one I remember once saw was InetMgr (https://github.com/typesafe/inetmgr), which seems a bit unstable and doesn't work for me, but it doesn't seem to be supported.

+5
source share
2 answers

Not the best answers, but since I could not find anything easier than the suggested method below, I just wrote something myself using appcmd:

def create_web_site(site_name, site_location, site_port)
  delete_command = "#{$file["appcmd"]} delete site #{site_name}"
  result = system delete_command
  puts "Failed to delete site on IIS: #{$?}" unless result

  add_command = "#{$file["appcmd"]} add site /name:#{site_name} /bindings:http/*:#{site_port}: /physicalPath:#{site_location}"
  result = system add_command
  raise "Failed to add site on IIS: #{$?}" unless result

  set_app_pool_command = "#{$file["appcmd"]} set app #{site_name}/ /applicationPool:\"ASP.NET v4.0\""
  result = system set_app_pool_command
  raise "Failed to bind site to .net 4 app pool on IIS: #{$?}" unless result

  start_site_command = "#{$file["appcmd"]} start site #{site_name}"
  result = system start_site_command
  raise "Failed to start site on IIS: #{$?}" unless result
end

$file["appcmd"] in the above example - a global file search for my build scripts, this is c: / windows / system32 / inetsrv.

, , - , , , . 2- 7 iis- script, , .

+6

Capistrano. Capistrano - "" ruby ​​/rails/.... , " " , Windows Server Capistrano.

+1

All Articles