방법: 계측할 Web.Config 파일 수정 및 동적으로 컴파일된 ASP.NET 웹 응용 프로그램 프로파일링
Visual Studio 프로파일링 도구의 계측 방법을 사용하여 동적으로 컴파일된 ASP.NET 웹 응용 프로그램에서 자세한 타이밍 데이터, .NET 메모리 할당 데이터 및 .NET 개체 수명 데이터를 수집할 수 있습니다.
이 항목에서는 web.config 구성 파일을 수정하여 ASP.NET 웹 응용 프로그램의 계측 및 프로파일링을 사용하도록 설정하는 방법에 대해 설명합니다.
[!참고]
샘플링 프로파일링 방법을 사용하는 경우나 미리 컴파일된 ASP.NET 모듈을 계측하려는 경우에는 web.config 파일을 수정할 필요가 없습니다.
web.config 파일의 루트는 configuration 요소입니다.동적으로 컴파일된 ASP.NET 웹 응용 프로그램을 계측하고 프로파일링하려면 다음 요소를 추가하거나 수정해야 합니다.
configuration/runtime/assemblyBinding/dependentAssembly 요소 - 프로파일링을 제어하는 Microsoft.VisualStudio.Enterprise.ASPNetHelper 어셈블리를 식별합니다.dependentAssembly 요소에는 assemblyIdentity와 codeBase라는 두 개의 자식 요소가 포함됩니다.
configuration/system.web/compilation 요소 - 대상 어셈블리에 대한 프로파일러의 후처리 컴파일 단계를 식별합니다.
두 개의 add 요소 - configuration/appSettings 섹션에서 프로파일링 도구가 추가되는 위치를 식별합니다.
응용 프로그램의 구성을 복원하는 데 사용할 수 있도록 원본 web.config 파일의 복사본을 만드는 것이 좋습니다.
ASPNetHelper 어셈블리를 configuration/runtime/assemblyBinding/dependentAssembly 요소로 추가하려면
필요하면 runtime 요소를 configuration 요소의 자식 요소로 추가하고, 그렇지 않으면 다음 단계로 이동합니다.
runtime 요소에는 특성이 없습니다.configuration 요소에는 runtime 자식 요소가 하나만 있을 수 있습니다.
필요하면 assemblyBinding 요소를 runtime 요소의 자식 요소로 추가하고, 그렇지 않으면 다음 단계로 이동합니다.
runtime 요소에는 assemblyBinding 요소가 하나만 있을 수 있습니다.
assemblyBinding 요소에 다음 특성 이름 및 값을 추가합니다.
특성 이름
특성 값
Xmlns
urn:schemas-microsoft-com:asm.v1
dependentAssembly 요소를 assemblyBinding 요소의 자식 요소로 추가합니다.
dependentAssembly 요소에는 특성이 없습니다.
assemblyIdentity 요소를 dependentAssembly 요소의 자식으로 추가합니다.
assemblyIdentity 요소에 다음 특성 이름 및 값을 추가합니다.
특성 이름
특성 값
name
Microsoft.VisualStudio.Enterprise.ASPNetHelper
PublicKeyToken
b03f5f7f11d50a3a
culture
Neutral
codeBase 요소를 dependentAssembly 요소의 자식으로 추가합니다.
codeBase 요소에 다음 특성 이름 및 값을 추가합니다.
특성 이름
특성 값
version
10.0.0.0
href
PathToASPNetHelperDll
PathToASPNetHelperDll은 Microsoft.VisualStudio.Enterprise.ASPNetHelper.dll의 파일 URL입니다.Visual Studio가 기본 위치에 설치된 경우 href 값은 C:/Program%20Files/Microsoft%20Visual%20Studio%202010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.ASPNetHelper.DLL이어야 합니다.
<configuration>
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1"
>
<dependentAssembly>
<assemblyIdentity name="Microsoft.VisualStudio.Enterprise.ASPNetHelper"
publicKeyToken="b03f5f7f11d50a3a" culture="neutral"
/>
<codeBase
version="10.0.0.0"
href="file:///C:/Program%20Files/Microsoft%20Visual%20Studio%2010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.ASPNetHelper.DLL"
/>
</dependentAssembly>
</assemblyBinding>
</runtime>
configuration/system.web/compilation 요소에 프로파일러 후처리 단계를 추가하려면
필요하면 system.web 요소를 configuration 요소의 자식 요소로 추가하고, 그렇지 않으면 다음 단계로 이동합니다.
system.web 요소에는 특성이 없습니다.configuration 요소에는 system.web 자식 요소가 하나만 있을 수 있습니다.
필요하면 compilation 요소를 system.web 요소의 자식 요소로 추가하고, 그렇지 않으면 다음 단계로 이동합니다.
system.web 요소에는 compilation 자식 요소가 하나만 있을 수 있습니다.
compilation 요소에서 모든 기존 특성을 제거하고 다음 특성 이름 및 값을 추가합니다.
특성 이름
특성 값
assemblyPostProcessorType
Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter, Microsoft.VisualStudio.Enterprise.ASPNetHelper, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
<configuration>
<runtime>
. . .
</runtime>
<system.web>
<compilation
assemblyPostProcessorType="Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter,
Microsoft.VisualStudio.Enterprise.ASPNetHelper,
Version=10.0.0.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
/>
</system.web>
<configuration>
configuration/appSettings 요소에 프로파일러 위치 설정을 추가하려면
필요하면 appSettings 요소를 configuration 요소의 자식 요소로 추가하고, 그렇지 않으면 다음 단계로 이동합니다.
appSettings 요소에는 특성이 없습니다.configuration 요소에는 appSettings 자식 요소가 하나만 있을 수 있습니다.
add 요소를 appSettings 요소의 자식으로 추가합니다.
add 요소에 다음 특성 이름 및 값을 추가합니다.
특성 이름
특성 값
key
Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation
value
PerformanceToolsFolder\VSInstr.Exe
또 하나의 add 요소를 appSettings 요소의 자식으로 추가합니다.
이 add 요소에 다음 특성 이름 및 값을 추가합니다.
특성 이름
특성 값
key
Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrTools
value
PerformanceToolsFolder
PerformanceToolsFolder는 프로파일러 실행 파일의 경로입니다.Visual Studio가 기본 위치에 설치된 경우 이 값은 C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools가 됩니다.
<configuration>
<runtime>
. . .
</runtime>
. . .
<system.web>
</system.web>
<appSettings>
<add
key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation"
value="C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\vsinstr.exe"
/>
<add
key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrTools"
value="C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\"
/>
</appSettings>
</configuration>
예제
다음은 동적으로 컴파일된 ASP.NET 웹 응용 프로그램의 계측 및 프로파일링을 사용하도록 설정하는 전체 web.config 파일입니다.이 예제에서는 수정하기 전에 파일에 다른 설정이 있었던 것으로 가정합니다.
<?xml version="1.0"?>
<configuration>
<runtime>
<assemblyBinding
xmlns="urn:schemas-microsoft-com:asm.v1"
>
<dependentAssembly>
<assemblyIdentity
name="Microsoft.VisualStudio.Enterprise.ASPNetHelper"
publicKeyToken="b03f5f7f11d50a3a"
culture="neutral"
/>
<codeBase
version="10.0.0.0"
href="file:///C:/Program%20Files/Microsoft%20Visual%20Studio%2010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.Enterprise.ASPNetHelper.DLL"
/>
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
<compilation
assemblyPostProcessorType="Microsoft.VisualStudio.Enterprise.Common.AspPerformanceInstrumenter,
Microsoft.VisualStudio.Enterprise.ASPNetHelper,
Version=10.0.0.0,
Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a"
/>
</system.web>
<appSettings>
<add
key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrLocation"
value="C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\vsinstr.exe"
/>
<add
key="Microsoft.VisualStudio.Enterprise.AspNetHelper.VsInstrTools"
value="C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Performance Tools\"
/>
</appSettings>
</configuration>
참고 항목
작업
방법: 명령줄에서 프로파일러를 사용하여 동적으로 컴파일된 ASP.NET 웹 응용 프로그램 계측 및 자세한 타이밍 데이터 수집
방법: 프로파일러 명령줄을 통해 동적으로 컴파일된 ASP.NET 웹 응용 프로그램 계측 및 메모리 데이터 수집