Azure 服务部署
部署步骤
- 将以下内容添加到 WebRole 项目,并将其"复制到输出目录"属性设置为"始终复制"。
a. .NET Agent 安装程序 (apminsight-dotnetagent.msi),
b. 包含许可证密钥及其他配置选项的"apminsight.conf"文件,以及
c. 批处理文件"deploy-apminsight.cmd"。 -
在服务定义文件 (.csdef)中添加如下启动任务:
<ServiceDefinition>
<WebRole>
<Startup>
<Task commandLine="deploy-apminsight.cmd configfile=apminsight.conf
appfilterconfigfile=appfilter.conf multimonitor=true/false"
executionContext="elevated" taskType="background"/>
</Startup>
</WebRole>
</ServiceDefinition>
已知问题及解决方法
在 Azure 虚拟机中,"W3SVC"服务(World Wide Web Publishing Service)的启动类型默认为"手动"。这可能会在安装 .NET Agent 后访问网站时导致"服务不可用"的问题(安装过程中会发生 IIS 重置)。请将启动类型设置为"自动"以规避此问题。可以通过在批处理文件中安装命令之前添加以下行来实现:sc config w3svc start= auto。
将以下脚本复制并粘贴到新文本文件中,并将其命名为 deploy-apminsight.cmd。
deploy-apminsight.cmd
REM Install the ApmInsight agent on Windows Azure
SETLOCAL EnableExtensions
REM Bypass the installation if already installed
IF DEFINED COR_PROFILER GOTO :ENDIF NOT EXIST apminsight-dotnetagent.msi GOTO :ENDREM set the w3svc IIS worker process startup service to autosc config w3svc start= autoREM Install the agentapminsight-dotnetagent.msi /quiet /log %windir%\ApmInsightInstall.log editconfig=false %*:ENDEXIT /B %ERRORLEVEL%
