Skip to content

HttpListener access denied on windows docker #3072

@Boskim0n0

Description

@Boskim0n0

HttpListener throws an access denied exception on windows dockers

  • .Net Core version: 3.00-preview6-27804-01
  • SO: Windows 10
  • Docker version: 18.09.2 build 6247962

Hi

Im doing my first proof of concept on dockers an netcore so we may move all of our infraestructure into dockers with netcore. I was trying to build a simple http listener that would return a hello world message. I create the docker image with visual studio 2019 but when i try to start it, the application returned the following exception

2019-07-23T12:15:46.267045600Z
Unhandled Exception: System.Net.HttpListenerException (5): Access is denied.
at MyApp.SvcLoader.StartWithArgs(String configPath, String loggerPath, Dictionary2 connectionStrings, AppRegisterer& appRegisterer, Dictionary2& appBuilderDict) in C:\src\MyApp\SvcLoader.vb:line 68
at MyApp.SvcLoader.StartWithArgs(String configPath, String loggerPath, AppRegisterer& appRegisterer, Dictionary`2& appBuilderDict) in C:\src\MyApp\SvcLoader.vb:line 44
at MyApp.SvcLoader.StartWithArgs(String[] args) in C:\src\MyApp\SvcLoader.vb:line 31
at MyApp.SvcLoader.Start(String[] args) in C:\src\MyApp\SvcLoader.vb:line 19
at MyApp.SvcLoader.Start() in C:\src\MyApp\SvcLoader.vb:line 15
at HelloWorldServer.Worker.ExecuteAsync(CancellationToken stoppingToken) in C:\src\HelloWorldServer\Worker.cs:line 24
at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.Run(IHost host)
at HelloWorldServer.Program.Main(String[] args) in C:\src\HelloWorldServer\Program.cs:line 15

The application code that i run is this:

this.Listener = new System.Net.HttpListener(); var prefixes = config.URLPrefix.Split(config.URLDelimiters); foreach (var prefix in prefixes) { Listener.Prefixes.Add(prefix); } Listener.Start(); Listener.BeginGetContext(IncomingRequest, null);

If i switch to linux containers, the exception is not thrown.

may i be doing something wrong?

Best regards

Fernando

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions