0

I'm able to query an IIS with the IIS SDK and detect which application are installed in the IIS.

        foreach (Site site in sites)
        {
            Console.WriteLine("Site: " + site.Name);

            foreach (Binding binding in site.Bindings)
            {
                Console.WriteLine("Binding Information: " + binding.BindingInformation);
            }

            foreach (Application app in site.Applications)
            {
                Console.WriteLine("App Path: " + app.Path);
            }
           
        }

My applications are web services (asmx and wcf). Is there a way to query each application and detect which methods are published?

What I need is the full URL of the webservice.

Is there a way to do it without the IIS SDK?

Thanks.

kruvi
  • 524
  • 1
  • 6
  • 16
  • In ASMX _specifically_, **yes** it is possible, because ASMX has WSDL support built-in (see https://stackoverflow.com/questions/20742589/how-to-get-the-wsdl-file-from-a-webservices-url/54127727 ) - but for others, it depends (WCF has MEX, and RESTful services (e.g. in ASP.NET Core) _can_ expose a Swagger JSON file, but this not enabled by default - however you still need to know the path to the `.asmx` endpoint. – Dai Oct 10 '21 at 10:29

1 Answers1

0

An application can have multiple urls based on number of bindings.

So you can use these properties to get the relevant information in your foreach loop.

binding.Host
binding.Endpoint.Address 
binding.Endpoint.Port

Based on these properties you can form the applications base urls.

Vivek Nuna
  • 25,472
  • 25
  • 109
  • 197
  • Thanks, but the result is a URL that does not include the method of the web service. This will give me this URL: http://myHost:1234/MyWebService While I need this: http://myHost:1234/MyWebService/Calculate – kruvi Oct 10 '21 at 10:10
  • 1
    @kruvi as far as I know, that is not possible. – Vivek Nuna Oct 10 '21 at 10:26