Search code examples
wcfwcf-data-serviceswcf-binding

How to replace Machine Name with Domain name in WCF Service


I'm get Machine Name in the WCF proxy and getting below exception while invoking WCF service

The remote server returned an error: (415) Cannot process the message because the content type 'application/soap+xml; charset=utf-8' was not the expected type 'text/xml; charset=utf-8'..HTTP GET Error
URI: http://MyDomine.com/TCIService/TCIService/TCIService.svc?wsdl
The document was understood, but it could not be processed. - The WSDL document contains links that could not be resolved. - There was an error downloading 'http://MyMachine.Name/TCIService/TCIService/TCIService.svc?xsd=xsd0'. - The remote name could not be resolved: 'MyMachineName'

Can any one please help me fix this issue. And below is my web.config

<system.serviceModel>
        <services>
            <service name="MyService.TCIService.TCIService" behaviorConfiguration="MyServiceBehaviour" >
                <endpoint address="Account" binding="basicHttpBinding" contract="MyService.TCIContract.IAccount"  >
                </endpoint>
                <endpoint address="Location" binding="basicHttpBinding" contract="MyService.TCIContract.ILocation"  >
                </endpoint>
                <endpoint address="Camera" binding="basicHttpBinding" contract="MyService.TCIContract.ICamera" >
                </endpoint>
                <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange">
                </endpoint>

                <!--<host>
                    <baseAddresses>
                        <add baseAddress="http://localhost:8080/"></add>
                    </baseAddresses>
                </host>-->
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="MyServiceBehaviour">
                    <serviceMetadata httpGetEnabled="true" />
                </behavior>
            </serviceBehaviors>
        </behaviors>
    </system.serviceModel>

Solution

  • Thanks for your response Tom. I fixed this issue using

    <behavior name="MyServiceBehaviour">
        <serviceMetadata httpGetEnabled="true" />
        <useRequestHeadersForMetadataAddress />
    </behavior>