The key 'LocalizedPerfCounter' does not exist in the appSettings configuration section.
윈도우 8.1에서 테스트용 ASP.NET 프로젝트를 만든 후 Global.asax에서 TCP 포트를 여는 코드를 작성했더니,
_listener = new TcpListener(IPAddress.Any, newPort);
다음과 같은 예외가 발생했습니다.
System.InvalidOperationException occurred
Message=The key 'LocalizedPerfCounter' does not exist in the appSettings configuration section.
Source=System
StackTrace:
at System.Configuration.AppSettingsReader.GetValue(String key, Type type)
InnerException:
검색해 보면 다음의 글이 나오는데요.
Hotfix rollup 2784156 is available for the .NET Framework 2.0 SP2 in Windows 8 and Windows Server 2012
; http://support.microsoft.com/kb/2784156/en-us
일단 ^^ 시간이 없으니 세부적인 것은 나중에 따지고, 해결 방법은 web.config에 다음의 appSettings 값을 넣어주는 것으로 해결할 수 있습니다.
<configuration>
<appSettings>
<add key="LocalizedPerfCounter" value="true" />
</appSettings>
</configuration>
제목에서 의미하는 바와 같이 .NET 2.0 웹 애플리케이션에서만 문제가 발생합니다.
참고로, Visual Studio에서 웹 프로젝트의 기본 디버깅은 WebDev.WebServer20.EXE / WebDev.WebServer40.EXE 또는 iisexpress.exe에서 호스팅되는데요. 이런 경우에는 다음의 경로에 있는 .config 파일을 변경해 주어야 합니다.
C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\WebDev.WebServer20.EXE.config
C:\Program Files (x86)\Common Files\Microsoft Shared\DevServer\10.0\WebDev.WebServer40.EXE.config
C:\Program Files\IIS Express\iisexpress.exe.config
C:\Program Files (x86)\IIS Express\iisexpress.exe.config
[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]