停止并开始在网站上放蛋糕

时间:2018-09-14 00:38:18

标签: teamcity cakebuild

我们将teamcity用于构建服务器,而我正在为一个不再与我们在一起的开发人员接管一个项目。他编写了一个build.cake文件,将我们的网站与其他内容一起推送到我们的服务器。我对此没有经验,需要更新它,以便在推送网站时也可以启动和停止网站和应用程序。在谷歌搜索中,我遇到了this。我已经使用以下更新了build.cake文件。

Task("deploy_live_websites")
    .IsDependentOn("use_live_config")
    .Does(() => 
    { 
        foreach (var site in websites){
            foreach (var server in liveServers){
                CreatePool(server, new ApplicationPoolSettings()
                {
                    Name = site.ApplicationPoolName,
                    Username = devWebDeployUser,
                    Password = devWebDeployPassword
                });
                CreateWebsite(server, new WebsiteSettings()
                {
                    Name = site.SiteName,
                    Binding = IISBindings.Http
                                .SetHostName(site.HostName)
                                .SetIpAddress("*")
                                .SetPort(80),
                    PhysicalDirectory = site.PhysicalDirectory,
                    ApplicationPool = new ApplicationPoolSettings()
                    {
                        Name = site.ApplicationPoolName
                    }
                });

                StopSite(server, site.SiteName);
                StopPool(site.ApplicationPoolName);

                DeployWebsite(new DeploySettings()
                {                   
                    SourcePath = "./artifacts/_PublishedWebsites/" + site.Name + "/",
                    ComputerName = server,
                    SiteName = site.SiteName,
                    Username = webDeployUser,
                    Password = webDeployPassword
                });

                StartPool(site.ApplicationPoolName);
                StartSite(site.SiteName);
            }           
        }
    });

具体来说,我所做的更新是StopSite,StopPool,StartPool,StarSite行。

当我将其推送到构建服务器时,它在执行时失败。我得到的错误是

[20:29:19][Step 1/1] ========================================
[20:29:19][Step 1/1] deploy_live_websites
[20:29:19][Step 1/1] ========================================
[20:29:19][Step 1/1] Executing task: deploy_live_websites
[20:29:19][Step 1/1] Application pool 'TECWare_v4' is system's default.
[20:29:19][Step 1/1] An error occurred when executing task 'deploy_live_websites'.
[20:29:19][Step 1/1] Error: One or more errors occurred.
[20:29:19][Step 1/1]    Could not load file or assembly 'System.Diagnostics.TraceSource, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
[20:29:19][Step 1/1] Process exited with code 1
[20:29:05][Step 1/1] Process exited with code 1
[20:29:19][Step 1/1] Step PowerShell failed

我不知道问题是什么。有人对如何解决这个问题有想法吗?在添加启动/停止方法之前,它运行良好。另外,我在文件顶部添加了#addin“ Cake.IIS”。

0 个答案:

没有答案