Reputation: 76805
We are trying to deploy a simple C# (framework 2.0) application which uses HttpListener
class on a Windows XP SP3 system: the application aborts at initialization because HttpListener.IsSupported
property is false
.
Question: what could make HttpListener
unsupported on a (reasonably) up-to-date XP system ?
Things that could matter:
Upvotes: 2
Views: 694
Reputation: 702
One possibility: XP Embedded does not seem to be supporting HttpListener/http.sys even with SP2 and later.
Upvotes: 0
Reputation: 6293
Okay, under the hood HttpListener
class calls
[StructLayout(LayoutKind.Sequential)]
internal struct HTTPAPI_VERSION
{
internal ushort HttpApiMajorVersion;
internal ushort HttpApiMinorVersion;
}
[DllImport("httpapi.dll", CallingConvention=CallingConvention.StdCall, SetLastError=true, ExactSpelling=true)]
internal static extern unsafe uint HttpInitialize(HTTPAPI_VERSION version, uint flags, void* pReserved);
On XP:
version.HttpApiMajorVersion = 2;
version.HttpApiMinorVersion = 0;
flags = 5;
pReserved = null;
Which is described here. And sets bool supported = HttpInitialize(...) == 0;
You can try to call it directly using PInvoke and check system error code returned
Upvotes: 2