codebrothers.net :: Home  >  Matthias Denkmaier
User: Guest  Login
Matthias Denkmaier
C# - what else?
Blog search:  
PlatformNotSupportedException when trying to open a socket in C#

A few days ago i ran into some strange behavior when trying to open a socket an a clients computer using a simple network enabled application:

...
[3452] System.PlatformNotSupportedException: This operation is only supported on Windows 2000 SP3 or later operating systems.
[3452]    at System.Security.Principal.SecurityIdentifier..ctor(WellKnownSidType sidType, SecurityIdentifier domainSid)
[3452]    at System.Diagnostics.SharedUtils.EnterMutexWithoutGlobal(String mutexName, Mutex& mutex)
[3452]    at System.Diagnostics.SharedPerformanceCounter.GetCounter(String counterName, String instanceName, Boolean enableReuse, PerformanceCounterInstanceLifetime lifetime)
[3452]    at System.Diagnostics.SharedPerformanceCounter..ctor(String catName, String counterName, String instanceName, PerformanceCounterInstanceLifetime lifetime)
[3452]    at System.Diagnostics.PerformanceCounter.Initialize()
[3452]    at System.Diagnostics.PerformanceCounter.set_RawValue(Int64 value)
[3452]    at System.Net.NetworkingPerfCounters.Initialize()
[3452]    at System.Net.Configuration.SettingsSectionInternal..ctor(SettingsSection section)
[3452]    at System.Net.Configuration.SettingsSectionInternal.get_Section()
[3452]    at System.Net.Sockets.Socket.SetToConnected()
[3452]    at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
[3452]    at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
...

But the computer on which the program was executed was already a  Windows Server 2003 Standard Edition.

After some hours of investigating why the application was running without any problems an my development maschine (WinXP Pro SP2) and always stopped with that specific error massage when running on the clients computer (Win2k3 Std.)  I found a simple, yet not obvious solution.

The reason for the framework to raise this error was, because the application was always started via a shortcut and someone at the clients site had enabled the Compatibility mode.

After disabling the compatibility mode everything ran like expected.

Small change, big result...

 

Share this post: Email it!
Posted:  02.03.2007 17:12:53  by  mdenkmaier
Tags:  C#Development
Comments are not allowed on this item!