StackTrace
StackTrace

Reputation: 9416

Mismatch in url addresses for ".svc" file and ".svc?wsdl" returned by svcutil.exe

i have a WCF service that is hosted in IIS behind a load balancer & the .svc file is at the following URL https://my-site-domain-Name.xyz.com/test/Service1.svc.

I can successfully browse to the above url and get the page with

"You have created a service.

To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:

svcutil.exe https://server-host-name.xyz.com/test/Service1.svc?wsdl"

NOTICE that i browsed to https://my-site-domain-Name.xyz.com/test/Service1.svc (used the domain name) but the URL returned next to svcutil.exe points at https://server-host-name.xyz.com/test/Service1.svc?wsdl (Uses machine name)

Is that the expected behavior? Isn't svcutil.exe also supposed to be pointing to this
https://my-site-domain-Name.xyz.com/test/Service1.svc?wsdl

Why is the svcutil.exe pointing to the server machine name and not the domain name?

My binding is defined like below

<endpoint address="" binding="customBinding" contract="App1.IService" bindingConfiguration="myBindingConfig" />

Could it because the endpoint address = "" (empty)?

Trying to now browse to the .svc?wsdl address pointed to by the svcutil.exe returns below error

HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Upvotes: 0

Views: 630

Answers (1)

Rodrigo
Rodrigo

Reputation: 1

Use option useRequestHeadersForMetadataAddress in web.config. Example:

<behavior name="TransmiteMensagemTISSBehavior">
    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
      <useRequestHeadersForMetadataAddress>      
      <defaultPorts>
        <add port="80" scheme="http"/>
      </defaultPorts>
    </useRequestHeadersForMetadataAddress>    
</behavior> 

Upvotes: 0

Related Questions