I am using wcf web service in my project (server-client) in local host mode and it works fine
now I need to connect to this service from another machine on the same local network
what should I change in the config file in my client ?
I changed the endpoint of my client to the IP开发者_如何转开发 of the machine that contains the local server and could not connect!
<endpoint address="http://10.131.40.22:8732/Design_Time_Addresses/WcfServiceLibrary_Test/Service1/"
binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_RepositoryManager"
contract="onlineExchangeCenter.RepositoryManager" name="WSHttpBinding_RepositoryManager">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
What errors are you getting? The issue could be firewall related.
I generally expose a MEX endpoint at the server and then generate the client config files through SVCutil.
First - you need to add a new endpoint to your service - for a connection inside your corporate LAN, I would recommend the netTcpBinding
:
<service name="someservice" behaviorConfiguration="....">
<endpoint name="existing"
address="......"
binding="wsHttpBinding"
contract="onlineExchangeCenter.RepositoryManager" />
<!-- add this *NEW* netTcpBinding endpoint -->
<endpoint name="corporateLAN"
address="net.tcp://YourServer:7171/YourService/SomeUrl"
binding="netTcpBinding"
contract="onlineExchangeCenter.RepositoryManager" />
</service>
Once you have this in place, you should update your client - either do a "right-click" on your service reference in Visual Studio and pick "Update Service Reference", or manually add this endpoint information to your client-side config, so that your client will now connect to the netTcp
endpoint on your server.
NetTcp is great in a LAN environment, but the ports used need to be open - if you have any firewalls or ISA servers inside your corporate environment, you might need to open these ports in order for this to work
精彩评论