.NET or Win32 Equivalent of "netsh http add urlacl" command
Asked Answered
A

2

22

There are several questions around how to allow a self-hosted WCF application to use BasicHttpBinding with HTTP.SYS without requiring administrative privileges. It boils down to needing to grant permission (from an admin context) to the URL, then the user can host whatever at the specified URL.

netsh http add urlacl url=http://+:80/MyService

I would like to be able to query and add registered URLs without resorting to parsing commandline output of the "netsh" or "httpconfig" commandline tools.

Is there is a public Win32 or .NET API that I can call for this functionality?

Acquiesce answered 27/7, 2011 at 20:58 Comment(0)
T
19

The Win32 API to use is HttpSetServiceConfiguration.

Tusk answered 27/7, 2011 at 21:45 Comment(1)
Ugh, I totally missed this. I was looking in "HTTP Server API Version 2.0 Functions" on MSDN thinking it would be a cumulative list of functions. Thanks!Acquiesce
G
4

I have exactly this problem in my bug list but it has currently low priority so I didn't deal with it yet. Anyway we found this tool (download the source) which uses mentioned function and it has all needed code to work (it is long way from having Win32 function and having working solution).

Gradualism answered 28/7, 2011 at 8:36 Comment(1)
The is no longer broken.Dric

© 2022 - 2024 — McMap. All rights reserved.