Answered by:
Could not connect to http://localhost:8080. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:8080.

Question
-
Hi folks,
I am quite new to WCF but have been with .NET for a while. I am developing a WCF application and using VS 2008 to do self hosting. On testing the application, i get the above error "TCP error code 10061 No connection made and target machine refused it on 127.0.0.1:8080 or localhost:8080".
I've tried few things liked disabling firewall but no success. A lot of reseach on the net but no success. I can't believe how hell this has been on my life. Any help would be appreciated.
Any help would be appreciated
Nick
Tuesday, April 3, 2012 1:23 PM
Answers
-
Hi Praburaj,
Thank you for your reply. Sorry for the late in getting back for the feedback you put across to me. Was due to me being poorly. Am alright now. I have managed to solve the problem. What I realise was that the service needs to be active at the time of testing for any client application that uses this service. When I run the client application that call the service which is not active, then error 10061 occurs. My service was self hosting, thus using WCF client service hosted in VS.
Another problem I realize was that, at times I had to remove and add back my service reference to my client application before everything works fine. This is weird, I suppose.
I tried your scenario and it also work for me. Thus: delete the
bindingConfiguration="WSHttpBinding_TaskManagerService" from client end point.An extra slash at the end of http://localhost:8080/Tasks/. Was my mistake and has been corrected.
Another final subject that I need to make you aware of is : the TaskService.Proxy.TaskManagerService is just a namespace hence making it Tasks.Service.ITaskManagerService will violate my namespace.
Thank you for your help. Well appreciated
Nick
Nick
- Proposed as answer by Dragan RadovacBanned Monday, April 9, 2012 9:06 PM
- Marked as answer by Yi-Lun Luo Monday, April 30, 2012 2:44 PM
Monday, April 9, 2012 9:00 PM
All replies
-
Hi Rupex,
Thank you for your reply. Here are the service and client configuration:
1. SERVICE -----------------------------------------
<configuration>
<system.serviceModel>
<services>
<service name="Tasks.Services.TaskManagerService"
behaviorConfiguration="Tasks.Services.TaskServiceBehavior">
<host>
<baseAddresses>
<add baseAddress = "http://localhost:8080/Tasks" />
</baseAddresses>
</host>
<endpoint address ="TaskManager"
binding="wsHttpBinding"
contract="Tasks.Services.ITaskManagerService" />
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="Tasks.Services.TaskServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>===================================================
2. CLIENT ------------------------------------------------
configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="WSHttpBinding_TaskManagerService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00"
enabled="false" />
<security mode="Message">
<transport clientCredentialType="Windows" proxyCredentialType="None"
realm="" />
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" establishSecurityContext="true" />
</security>
</binding>
</wsHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8080/Tasks/TaskManager" binding="wsHttpBinding"
bindingConfiguration="WSHttpBinding_TaskManagerService" contract="TaskService.Proxy.TaskManagerService"
name="WSHttpBinding_TaskManagerService">
<identity>
<userPrincipalName value="PC-5FDAF4ED5C74\fisco" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>Nick
Tuesday, April 3, 2012 2:21 PM -
Hello Nick,
On a quick glance I can see the following things can be fixed in the configuration.
1. Client not using the default wsHttpBinding settings. Try copying the same binding settings to the service or delete the
bindingConfiguration="WSHttpBinding_TaskManagerService" from client end point.2. Make the base address of the service to http://localhost:8080/Tasks/. Notice an extra slash at the end.
3. Contract at client side has to be Tasks.Services.ITaskManagerService not TaskService.Proxy.TaskManagerService
If it does not work still. Try adding svc traces to see what's more. To configure tracing: http://msdn.microsoft.com/en-us/library/ms733025.aspx
Thanks,
Praburaj
- Marked as answer by Yi-Lun Luo Monday, April 9, 2012 9:42 AM
- Unmarked as answer by fisco75 Monday, April 9, 2012 9:00 PM
Tuesday, April 3, 2012 4:20 PM -
Hi Praburaj,
Thank you for your reply. Sorry for the late in getting back for the feedback you put across to me. Was due to me being poorly. Am alright now. I have managed to solve the problem. What I realise was that the service needs to be active at the time of testing for any client application that uses this service. When I run the client application that call the service which is not active, then error 10061 occurs. My service was self hosting, thus using WCF client service hosted in VS.
Another problem I realize was that, at times I had to remove and add back my service reference to my client application before everything works fine. This is weird, I suppose.
I tried your scenario and it also work for me. Thus: delete the
bindingConfiguration="WSHttpBinding_TaskManagerService" from client end point.An extra slash at the end of http://localhost:8080/Tasks/. Was my mistake and has been corrected.
Another final subject that I need to make you aware of is : the TaskService.Proxy.TaskManagerService is just a namespace hence making it Tasks.Service.ITaskManagerService will violate my namespace.
Thank you for your help. Well appreciated
Nick
Nick
- Proposed as answer by Dragan RadovacBanned Monday, April 9, 2012 9:06 PM
- Marked as answer by Yi-Lun Luo Monday, April 30, 2012 2:44 PM
Monday, April 9, 2012 9:00 PM