Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (5.8k points)

I have a simple service that I deployed to Azure. It is accessible via:

http://xxxxxxxxxxxxxxxxxxxxxxx.cloudapp.net/MyTestService.svc

The URL to the WSDL uses the internal machine name instead of a public DNS:

svcutil.exe http://rd001520d328923a/MyTestService.svc?wsdl

Obviously, the WSDL is not accessible from outside the machine with this.

I am aware of a few things that can be changed if you are running this in IIS, or if you do know the url of the service. For example, changing the <serviceMetadata> config to specify the httpGetUrl property, but this will not work as I would have to include the absolute URL. Using a relative URL, it still uses the internal machine name. The real issue is that the WSDL includes URL references with the machine name, therefore rendering it useless.

There are two substandard workarounds:

It has been suggested that I could grab the WSDL, edit it to fix the URLs and then upload it so it is accessible from a different URL.

I found a hotfix from early 2010 was available, but there's got to be a better way.

How can this be solved to have the public facing DNS used instead of the machine name?

1 Answer

0 votes
by (9.6k points)

Add the following to the configuration file:

<serviceBehaviors>

   <behavior name="<name>">

     <!-- Other options would go here -->

     <useRequestHeadersForMetadataAddress>

       <defaultPorts> <!-- Use your own port numbers -->

          <add scheme="http" port="81" />

          <add scheme="https" port="444" />

        </defaultPorts>

      </useRequestHeadersForMetadataAddress>

   </behavior>

</serviceBehaviors>

Browse Categories

...