简体   繁体   中英

Programmatically check for Http namespace reservation

I have been tasked with writing a program which will run a set of diagnostic tests on our main application. One application uses WCF over HTTP (this is for interoperability reasons, so cannot be changed to use NET.TCp or any other flavour of WCF comms channel) and because it should not be running under elevated privileges it requires a HTTP Namespace reservation to be made ( https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/configuring-http-and-https ).

My question is - is it possible to programmatically find out if the namespace reservation has been made in an OS agnostic manner (using C# / .NET 3.5 or 4)? The only way I can think of doing this is to create a small WCF application which will try to communicate over the http channels I am interested in and catching an exception... but it seems like a really un-elegant way of solving my problem.

The reason I want to be able to find out is that a number of customers have 'forgotton' to make the reservation, and so it has been generating calls - the diagnostic program is aimed at checking well known issues such as this one and displaying a friendly warning because debugging WCF on a client site is just not my idea of fun.

AFAIK there is no programmatical ways to discover it unless you make a call to the service. ACL is setted up on a system level on the server side. Server doesn't share that kind of information. The only answer you will be able to know whether access is granted or not.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM