how to bind WCF service to IP address

前端 未结 2 1689
情歌与酒
情歌与酒 2021-01-07 07:43

I am developing a WCF service hosted by IIS, using VSTS2008 + C# + .Net 3.5. I find when reference the service from a client by using Add Service Reference..., client has to

2条回答
  •  执笔经年
    2021-01-07 08:11

    If your WCF service is hosted in IIS, you cannot set a separate address. You must use the URL of the virtual directory where your SVC file lives - either with a machine name (http://yourserver/virtualdir/myservice.svc) or an IP (http://123.123.123.123/virtualdir/myservice.svc).

    If you use the IP to add the service reference, that IP will be used in the WSDL generated by the service import.

    If you host the WCF service yourself (Windows service, console app), you can set the service address in config, and use either machine name or IP for the machine.

    Marc

提交回复
热议问题