Cannot access WCF service remotely

前端 未结 1 766
情深已故
情深已故 2021-01-20 03:36

BACKGROUND

We have a WCF web service hosted in a Windows Service running with the basicHttpBinding

相关标签:
1条回答
  • 2021-01-20 04:24

    Try using useRequestHeadersForMetadataAddress

    <system.serviceModel>
      <behaviors>
        <serviceBehaviors>
          <behavior>
            <useRequestHeadersForMetadataAddress />
          </behavior>
        </serviceBehaviors>
      </behaviors>
    </system.serviceModel>
    

    This will allow the service to insert the URI you used to access the service in to the metadata so the wsdl aligns. Sometimes you'll go to access http://1.2.3.4/service.svc but the metadata will reference http://localhost. Locally that's fine, but remotely that makes grabbing the endpoint information impossible. Instead, now all those localhost references will use 1.2.3.4 instead.

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