简体   繁体   English

从SSIS包转向IIS上托管的网站

[英]Turn of web site hosted on IIS from SSIS package

I have SSIS package which executes several minutes. 我有SSIS包,执行几分钟。 It copies data to my PROD database. 它将数据复制到我的PROD数据库。 Package is launched from Sql Server Job. 包从Sql Server Job启动。 I'd like to take my web site offline during executing of the package. 我想在执行包时让我的网站脱机。 How do I can turn off my web site before execution and then turn on it back automatically? 如何在执行前关闭我的网站,然后自动将其打开?

I use Sql Server 2008 and IIS6. 我使用Sql Server 2008和IIS6。

Thanks 谢谢

Here is a possible option: 这是一个可能的选择:

Within the SSIS package : Within the SSIS package

  • Create a batch file named StopWebsite.bat with the following command: 使用以下命令创建名为StopWebsite.bat的批处理文件:

    iisreset /stop computername

  • Create another batch file named StartWebsite.bat with the following command: 使用以下命令创建另一个名为StartWebsite.bat的批处理文件:

    iisreset /start computername

  • In the SSIS package, place an Execute Process Task in the Control Flow tab. 在SSIS包中,在“控制流”选项卡中放置“ 执行进程任务 ”。 Call the first batch file StopWebsite.bat from the Execute Process task. 从Execute Process任务调用第一个批处理文件StopWebsite.bat This will stop the Internet Information Services (IIS). 这将停止Internet信息服务(IIS)。

  • Place all your other tasks after the first Execute Process Task. 在第一个执行流程任务之后放置所有其他任务。

  • After all your other tasks in the Control Flow tab, place another Execute Process Task . 完成“控制流”选项卡中的所有其他任务后,再放置另一个“ 执行进程任务” Call the second batch file StartWebsite.bat . 调用第二个批处理文件StartWebsite.bat This will start the IIS. 这将启动IIS。

  • Note that you need to place the batch files in a location where the SSIS package can access them from the production environment. 请注意,您需要将批处理文件放在SSIS包可以从生产环境访问它们的位置。

Within the SQL Server job : Within the SQL Server job

  • If you don't want to do this in the SSIS package. 如果您不想在SSIS包中执行此操作。 You need to have three steps in your SQL Server Job. 您需要在SQL Server作业中执行三个步骤。

  • Step 1 would execute the command iisreset /stop computername as job of type Operating System (CmdExec) 步骤1将执行命令iisreset /stop computername作为操作系统类型的作业(CmdExec)

  • Step 2 would call the SSIS package. 第2步将调用SSIS包。

  • Step 3 would execute the command iisreset /start computername as job of type Operating System (CmdExec) 步骤3将执行命令iisreset /start computername作为操作系统类型的作业(CmdExec)

  • If you run into permissions issue, make sure that the account (usually it is SQL Server Agent Account ) in which the step is being executed has permissions to restart IIS on the remote server. 如果遇到权限问题,请确保正在执行步骤的帐户(通常是SQL Server代理帐户 )具有在远程服务器上重新启动IIS的权限。 You could also try to use a proxy account that would make use of a domain account credentials, in the following link screenshots 8 - 14 explains how to create a proxy account on job type SSIS Package Execution . 您也可以尝试使用代理帐户,将使用的域帐户凭据,在下面的链接截图8 - 14介绍如何创建作业类型SSIS包执行代理帐户。 You might need to do something similar on the Operating System (CmdExec) job type. 您可能需要在操作系统(CmdExec)作业类型上执行类似操作。 How do I create a step in my SQL Server Agent Job which will run my SSIS package? 如何在我的SQL Server代理作业中创建一个将运行我的SSIS包的步骤?

Replace computername with your actual computer name or IP address of the machine where your website is hosted. computername名替换为您托管网站的computername的实际计算机名称或IP地址。

I would say option #2 is easier to maintain. 我会说选项#2更容易维护。

Hope that helps. 希望有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 iis托管的网站与本地网站不同 - iis hosted web site differs from local web site 如何将网站从IIS托管站点更改为ASP.Net Development Server托管站点? - How do I change a web site from an IIS hosted site to an ASP.Net Development Server hosted site? 从IIS获取我托管的Asp.Net网站的运行会话数 - Get running session count from IIS for my hosted Asp.Net web site 从网站上托管的视频中提取图像 - Extract an image from a video hosted on a web site 如何将用户身份从一个IIS中托管的Web应用程序传递到另一个IIS中托管的Web服务? - How to pass on user's identity from web application hosted in one IIS to the web service hosted in another IIS? 想要从模拟器连接到托管在 IIS 中的本地站点,而不是本地主机 - Want to connect to a local site hosted in IIS from the emulator, not localhost though 如何从另一台PC访问IIS托管站点 - How to access IIS hosted site from another PC 从IIS上的网站访问NAS - Access NAS from web site on IIS 如何从由ServiceHost托管的IIS Web服务访问文件 - How to access a file from IIS web service hosted by ServiceHost 无法从远程计算机查看我的IIS托管站点,但IIS页面已打开 - unable to view my IIS hosted site from remote machine but IIS page open
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM