WCF not using computer name instead of domain name when viewing MyService.svc?wsdl

后端 未结 13 1288
迷失自我
迷失自我 2020-12-13 02:31

My WCF serice seems to be using the computer-name instead of the domain name. When I view the MyService.svc?wsdl link it is showing my computer name.

Wh

相关标签:
13条回答
  • 2020-12-13 02:52

    None of these solutions were helpful to me. I was able to solve this with a very simple custom Service Factory.

    Installing a WCF Service on a Shared Hosting Site, Revisited

    0 讨论(0)
  • 2020-12-13 03:00

    Thanks to Kanasz Robert. Steps that solved my problem - 1.Produce the wsdl in the browser and save to file (by hitting .svc?wsdl from browser) save as .wsdl

    1. Produce the xsd files by hitting url from wsdl (xsd=xsd0, etc), and save to file from browser, save as .wsdl

    2. replace all machine name references from wsdl with domain name (or ip address) and change xsd references and save AND replace all machine name references from xsd files with domain name (or ip address) make sure to name xsd file with .xsd extension (ie, name0.xsd, name1.xsd, name2.xsd)

    3. copy wsdl and xsd file(s) to virtual directory add to your web.config following lines:

    <behaviors>
          <serviceBehaviors>
            <behavior name="MyServiceBehavior">
              <serviceMetadata httpGetEnabled="true" externalMetadataLocation="http://IPorDomainName/MyServices/FileTransferService.wsdl"  />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>

    0 讨论(0)
  • 2020-12-13 03:02

    This post solved it for me. I needed to associate my domain name with my IP address and website in IIS.

    http://www.codemeit.com/wcf/wcf-wsdl-xsdimport-schemalocations-link-to-local-machine-name-not-domain-name-while-hosted-in-iis.html

    0 讨论(0)
  • 2020-12-13 03:03

    WCF 4.0 has solved this issue in some instances with a new config option that use Request Headers:

        <behaviors>
            <serviceBehaviors>
                <behavior name="AutoVaultUploadBehavior">
                    <useRequestHeadersForMetadataAddress>
                        <defaultPorts>
                            <add scheme="https" port="443" />
                        </defaultPorts>
                    </useRequestHeadersForMetadataAddress>
    
    0 讨论(0)
  • 2020-12-13 03:03

    As stated in this link WCF is using the computer name instead of the IP address and cannot be resolved

    It solved my problem, maybe because i have multiple web sites in the same host, and is very simple.

    <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
    
    0 讨论(0)
  • 2020-12-13 03:04

    Have you tried setting the host header in IIS?

    0 讨论(0)
提交回复
热议问题