PlatformNotSupportedException是因为调用Web服务时的性能计数器

时间:2011-03-15 14:49:00

标签: .net web-services performancecounter

从Winform应用程序调用Web服务时,我在Windows XP Home Edition(SP3)中遇到PlatformNotSupportedException。

堆栈跟踪如下:

 System.PlatformNotSupportedException: Feature requires Windows 2000 or later.
    at System.Diagnostics.SharedUtils.CheckNtEnvironment()
    at System.Diagnostics.PerformanceCounter.Initialize()
    at System.Diagnostics.PerformanceCounter.set_RawValue(Int64 value)
    at System.Net.NetworkingPerfCounters.Initialize()
    at System.Net.Configuration.SettingsSectionInternal..ctor(SettingsSection section)
    at System.Net.Configuration.SettingsSectionInternal.get_Section()
    at System.Net.HttpWebRequest.get_DefaultMaximumResponseHeadersLength()
    at System.Net.HttpWebRequest..ctor(Uri uri, ServicePoint servicePoint)
    at System.Net.HttpRequestCreator.Create(Uri Uri)
    at System.Net.WebRequest.Create(Uri requestUri, Boolean useUriBase)
    at System.Net.WebRequest.Create(Uri requestUri)
    at System.Web.Services.Protocols.WebClientProtocol.GetWebRequest(Uri uri)
    at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebRequest(Uri uri)
    at System.Web.Services.Protocols.SoapHttpClientProtocol.GetWebRequest(Uri uri)
    at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)

任何人都知道发生了什么事? THX

1 个答案:

答案 0 :(得分:1)

用户已创建启动应用程序的快捷方式,并已将兼容模式设置为Windows NT 4。

关闭兼容模式解决了这个问题。