HTTPListener operation is not supported on this platform

message operation is not supported on this platform string
operation is not supported on this platform fromxmlstring
the requested operation is not supported in this platform
exception thrown system platformnotsupportedexception in system net requests dll
restsharp platform not supported

I just added in a simple HTTPListener test to my application. It runs fine on Windows 10 x64, but refuses to run on Server 2008 R2 Standard x64. I am running it as Administrator (otherwise I get "access denied"). I checked that nothing else is trying to bind to the same port (I would get a different error):

Imports System.Net

Public Class Test
  Public ReadOnly Property Address As String
      Return _Address
    End Get
  End Property

  Public ReadOnly Property Port As Integer
      Return _Port
    End Get
  End Property

  Private _Address As String
  Private _Port As Integer

  Private listener As HttpListener
  Private listenerThread As Threading.Thread

  Public Sub New(ByVal addr As String, ByVal p As Integer)
    _Address = addr
    _Port = p
  End Sub

  Public Sub Start()
    listener = New HttpListener()
    listener.Prefixes.Add("http://" & Address & ":" & Port & "/")
    listenerThread = New Threading.Thread(AddressOf ListenerThreadSub)
  End Sub

  Public Sub ListenerThreadSub()
    While listener.IsListening
      Dim response As HttpListenerResponse = Nothing
        Dim context As HttpListenerContext = listener.GetContext()
        Dim path As String = context.Request.Url.LocalPath
        response = context.Response
      Catch ex As Exception

      End Try
    End While
  End Sub

  Public Sub Finish()
  End Sub

End Class

This is my test button:

Private Sub TestToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles TestToolStripMenuItem.Click
  Dim TestService As Test = New Test("FQDNOFSERVER", PORT)
End Sub

Target framework is .NET 4.6.1, but this class seems to be supported since .NET 4. The IsSupported property is set to False.

Some times there are other services using the port, some times the service are disabled.

run with elevation:

net stop http /y

sc config http start= demand

A restart may be necessary.

why i can't use HttpListener in my Windows 10 computer? (System , HttpListener h = new HttpListener();. Error: System.​PlatformNotSupportedException: Operation is not supported on this platform In System.Net.HttpListener..ctor(). true if HttpListener is supported; otherwise, false. Examples The following code example demonstrates the use of the IsSupported property to detect whether an HttpListener object can be used with the current operating system.

I fixed it by setting the "HTTP" driver in Device Manager to "Demand". "HTTP" (along with other Non-PnP) can be found by going to View > Show Hidden Devices.

I ran across this article that made me wonder if the HTTP driver was enabled.

System.PlatformNotSupportedException: 'Operation is not supported , PlatformNotSupportedException: 'Operation is not supported on this platform.' #​172. Closed. Old-T opened this issue on Mar 21, 2018 · 10 comments. Closed  Mono / httpcfg on Linux fails with "Operation is not supported on this platform." #14152 alvarengasv opened this issue Apr 21, 2019 · 17 comments · Fixed by #14860

Okay in my case it was http service problem, but it was deeper.

With @Artur ABC method i saw that i can't start http service again. It was The configuration registry database is corrupt..

I had to go to Registry and Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\HTTP\Parameters\SslBindingInfo\, then i found that ine of binded service is set on my old local ip, when i restarted my network i had a new ip address, and i had to delete old service from registry.

Fixing PlatformNotSupportedException when running Window , PlatformNotSupportedException: Operation is not supported on this platform. at System.Net. for my case, it is because ServiceHost is not able to load the HTTP system driver (http.sys) required to run a HTTP listener from . File: net\System\Net\HttpListener.cs Project: ndp\fx\src\System.csproj (System) //-----// <copyright file="HttpListener.cs" company="Microsoft"> // Copyright (c, PlatformNotSupportedException: Operation not supported on this platform. in System.Net.HttpListener..ctor () in Nancy.Hosting.Self.NancyHost. System.Net.HttpListener does not support many modern protocols. It is compat-only (i.e. only critical fixes, no new improvements, enhancements). It's useful for low-volume basic server requests, but does not scale to modern requirements of HTTP servers (incl. performance). Use KestrelHttpServer instead.

Stingray Installation - Autodesk Community, with mono with error "Operation is not supported on this platform". a previous mono version it is still usable with HttpListener after updating to 5.20. These objects share some functionality with the HttpWebRequest and HttpWebResponse objects, but the latter objects cannot be used in conjunction with HttpListener because they implement client, not server, behaviors.

Mono / httpcfg on Linux fails with "Operation is not , PlatformNotSupportedException: Operation is not supported on this platform. at System.Net.HttpListener..ctor() at System.ServiceModel. System.Runtime.dll, mscorlib.dll, netstandard.dll. The exception that is thrown when a feature does not run on a particular platform.