2

I am getting the following error while trying to add service in my application

Metadata contains a reference that cannot be resolved: 'net.tcp://[address]/myWCFService'. Could not connect to net.tcp://[address]/myWCFService. The connection attempt lasted for a time span of 00:00:21.0010000. TCP error code 10060: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [address]:808. A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond [address]:808 If the service is defined in the current solution, try building the solution and adding the service reference again.

I have created a WCF service and added it to asp.net host application when i am testing it locally on my system it is working fine but when hosted on our server getting error .

Web Config :-

<system.serviceModel>
    <behaviors>
        <serviceBehaviors>
            <behavior name="myBehavior">
                <serviceMetadata />
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <bindings>
        <netTcpBinding>
            <binding name="myBinding" />
        </netTcpBinding>
    </bindings>
    <services>
        <service behaviorConfiguration="myBehavior" name="GChatService.Chat">
            <endpoint address="net.tcp://[address]:808/myWCFService"
                binding="netTcpBinding" bindingConfiguration="myBinding" name="nettcp"
                contract="GChatService.IChat" />
            <endpoint address="net.tcp://[address]:808/myWCFService/mex"
                binding="mexTcpBinding" bindingConfiguration="" name="mex"
                contract="IMetadataExchange" />
            <host>
                <baseAddresses>
                    <add baseAddress="net.tcp://[address]:808" />
                </baseAddresses>
                <timeouts closeTimeout="00:02:10" openTimeout="00:10:00" />
            </host>
        </service>
    </services>      
</system.serviceModel>

Asp host code

Gaurav verma
  • 21
  • 1
  • 1
  • 3

4 Answers4

3

Check firewall settings. Maybe on your local system 808 is open and in the hosting envirenment it's blocked somewhere. Typical reason for 10060 Error

2

go to firewall-advanced settings-inbound Click Inbound Rules in the left column. Click New Rules in the right column. Select Port and click next. Select TCP and enter 8000, 8001, 8002, 8003, 9001, 80, 443 in the Specific local ports field. Click Next. Select Allow the connection, and click Next . Select Domain and Private, and click Next. Name this rule WCF-WF 4.0 Samples, and click Finish. Click Outbound Rules and repeat steps c to h.

harsh
  • 21
  • 4
  • I had the same problem, I just had to enable the port in the server firewall settings, everything started working. – Kurubaran Nov 15 '19 at 09:37
0

There are two reasons for it: 1: either get your port white listed if it is not responding. 2: timeout problem with seconds and millisecond, if you give 3600, it does not mean 1 hour, it is in milliseconds actually, so make a check of it.

shahzeb khan
  • 19
  • 1
  • 1
  • 6
0

By default in binding section useDefaultWebProxy will be true, make this as false