0

I've WCF service and .net client on local machine. I've generated wsdl for the client. It has bunch of files like .svcinfo, .wsdl, .xsd, .svcmap, .cs. Some of the files have address of the service https://localhost:12345/foo/bar.svc

Eventually the service and the client will be deployed to testing and then to production. At that time do I need to regenerate the wsdl for the client to reflect the correct urls in the .svcinfo, .wsdl, .xsd, .svcmap, .cs files? Or changing the endpoint address in the client config file is enough?

gmail user
  • 2,753
  • 4
  • 33
  • 42

1 Answers1

0

You have absolutely no need to do such a thing. We usually expose metadata information about a WCF service through its metadata endpoint. The client can then generate a client proxy class by adding a service reference, and the proxy class can implement calls to the service.

<services>
      <service name="WcfService1.Service1">
        <endpoint address="" binding="wsHttpBinding" contract="WcfService1.IService1"></endpoint>
        <!--metadata service endpoint-->
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint>
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!--Enable service metadata publish-->
          <serviceMetadata/>
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
</behaviors>

Client-side.
enter image description here
Optionally, we can also publish service data in the form of HTTP/https, just configure the properties below.

  <!--Enable service metadata publish-->
  <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/>

By which, the client could directly download the WSDL/SingleWSDL file, so that generate the client proxy class manually.
enter image description here
Feel free to let me know if there is anything I can help with.

Abraham Qian
  • 7,117
  • 1
  • 8
  • 22