.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Kaviya Balasubramanian
Imran Ghani
Post New Web Links

Socket Connection Is Actively Refused

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :WPF
 
I have a server application written is C/C++ that finds an available port, creates a socket, and starts listening.  The server posts its IP Address and port to a database so that clients can connect to the server.  I have a Client application written in C/C++ that has no problem connecting to this server; however, I am rewriting that client application in C# and I cannot get the client to connect to the server.  I consistently receive a "No connection could be made because the target machine actively refused it 10.0.0.6:26069" exception.  I have stepped through the code and the IP Address and port look correct to me.  I don't think this is a firewall problem since my other client is able to connect and I have tried my new client with the firewall disabled.  The server is using verson 2.0 sockets.  Below is the code I am using in my C# client to try to connect to my server.
// Create an IP Address from the data read from the DB


View Complete Post


More Related Resource Links

No connection could be made because the target machine actively refused it ipadd:port at system.Net.

  
Hi, I am writing code to send  an email whenever my application has an unhandled error. With this same code i could get it runnign on a gmail smtp server. However, when i replaced these values wit hvalues for my smtp host, i am gettin the following error. Why am i getting this error? Private Sub EmailTest(ByVal errorMsg As String) Dim SmtpServer As New SmtpClient() SmtpServer.Credentials = New Net.NetworkCredential("me@tremail.com", "test123") SmtpServer.Port = 22 SmtpServer.Host = "smtp.myhost.com" SmtpServer.EnableSsl = True Dim mail As New MailMessage() Try mail.From = New MailAddress("me@tremail.com", "Web Developers", System.Text.Encoding.UTF8) mail.To.Add("target@tremail.com") mail.Subject = "Error Messages in Application" mail.Body = errorMsg SmtpServer.Send(mail) Catch ex As Exception MsgBox(ex.ToString()) End Try End Sub I am getting the following error. System.Net.Mail.smtpException:Failure sending Mail.----->System.Net.WebException:Unable to connect to remote server---->System.Net.Sockets.socketException:No connection could be made because the target machine actively refused it ipadd:port at system.Net.sockets.Socket.doConnect

Fixed : Report builder 3.0 : "Connection failed", "actively refused"

  

Edit : ok, I screw up.

My Sql server wasn't a R2. 

I don't understand how I downloaded the wrong version and successfully install R2 sp1...

I really don't get it. But that fixed now.

---

Hi, i'm running 

 

  • windows 7 x64 Pro
  • Sql server 2008 R2 + Sp1
  • Microsoft SQL Server Reporting Services Version 10.0.2531.0

i'm able to connect to my reportservice with BIDS and Report Builder 2.0.
But with Report Builder 3.0 (10.50.1600.1, running as Admin) the connection failed.
I sniffed the packet with fiddler and found an 
[Fiddler] 504 Connection Failed: No connection could be made because the target machine actively refused it 192.168.1.170:443<BR>Timestamp: 11:49:18.676

---

Edit : add connection Fiddler resume.

 

#	Result	Protocol	Host	URL	Body	Caching	Content-Type	Process	Comments	Custom	
1	401	HTTP	guillaume-pc	/ReportServer/ReportService2010.asmx	0			msreportbuilder:5292			
2	401	HTTP	guillaume-pc	/ReportServer/ReportService2010.asmx	0			msreportbuilder:5292			
3	200	HTTP	guill

TCP error code 10061: No connection could be made because the target machine actively refused it.

  
I hosted a wcf service application using windows services. When my client (ASP.NET) tries to call the service class hosted by the windows service, I get this error "TCP error code 10061: No connection could be made because the target machine actively refused it. ". Is there a fix for this? The same code works fine if I host it using a console application.

No connection could be made because the target machine actively refused it 127.0.0.1:8888

  

Hi This is Satish Nandigam,

I develop a Restful web service in vs 2008

I hosted in the IIS 5.1 . Its working perfectly while i ping the url in the browser

like http://localhost/servicename/serversice.svc

http://satishn/servicename/serversice.svc

http://192.168.1.123/servicename/serversice.svc.

 

But problem is  consume the service in the client code.

I am able consume the service http://localhost/servicename/serversice.svc

but change the url like

http://satishn/servicename/serversice.svc

http://192.168.1.123/servicename/serversice.svc. its give error like Unable connect to the server. And i see the inner exception is No connection could be made because the target machine actively refused it 127.0.0.1:8888.

 

Here is the Exception details

 

System.Net.WebException was unhandled by user code
  Message="Unable to connect to the remote server"
  Source="System"
  StackTrace:
       at System.Net.HttpWebRequest.GetResponse()
       at SatoreServiceClient.Default.Button6_Click(Object sender, EventArgs e) in D:\Projects\Satori WebService\Client\Default.aspx.cs:line 398
       at System.Web.UI.WebControls.Bu

No connection could be made because the target machine actively refused it 127.0.0.1:8888

  

Hi This is Satish Nandigam,

I develop a Restful web service in vs 2008

I hosted in the IIS 5.1 . Its working perfectly while i ping the url in the browser

like http://localhost/servicename/serversice.svc

http://satishn/servicename/serversice.svc

http://192.168.1.123/servicename/serversice.svc.

 

But problem is  consume the service in the client code.

I am able consume the service http://localhost/servicename/serversice.svc

but change the url like

http://satishn/servicename/serversice.svc

http://192.168.1.123/servicename/serversice.svc. its give error like Unable connect to the server. And i see the inner exception is No connection could be made because the target machine actively refused it 127.0.0.1:8888.

 

Here is the Exception details

 

System.Net.WebException was unhandled by user code
  Message="Unable to connect to the remote server"
  Source="System"
  StackTrace:
       at System.Net.HttpWebRequest.GetResponse()
       at SatoreServiceClient.Default.Button6_Click(Object sender, EventArgs e) in D:\Projects\Satori WebService\Client\Default.aspx.cs:line 398
       at System.Web.UI.WebControls.Bu

No connection could be made because the target machine actively refused it

  

I am on the console of a server with a SQL Server 2008 installation.

I CAN successfully connect to the instance with this command:     c:\>    sqlcmd -E -S localhost\DW

I can NOT successfully connect with this one:    c:\>   sqlcmd -E -S localhost\DW,1433

---

  • Remote Server connections are enabled under server properties, connections
  • Under SQL Server configuration manager, "Protocols for DW" has TCP/IP enabled, TCP Dynamic Ports empty, TCP Port set to 1433.
  • My firewall is shutdown
  • I've restarted the SQL Server instance after config manager changes.

 

I receive this message:

HResult 0x274D, Level 16, State 1
TCP Provider: No connection could be made because the target machine actively refused it.

Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..Sqlcmd: Error: Microsoft SQL Server N

No connection could be made because the target machine actively refused it

  

I am using SharePoint 2010 Word Automation Services to convert documents (docx to xps).

When I try to start the ConversionJob, I get the following exception:

EndpointNotFoundException

Could not connect to http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc/actas. TCP error code 10061: No connection could be made because the target machine actively refused it 127.0.0.1:32843.

The method generate this Exception is the Start() one. The code is the following one:

//...<br/>
ConversionJob job = new ConversionJob(wordAutomationServiceName);<br/>
job.UserToken = spSite.UserToken;<br/>
job.Settings.UpdateFields = true;<br/>
job.Settings.OutputFormat = SaveFormat.XPS;<br/>
job.AddLibrary(inputListName, outputListName);<br/>
         <br/>
job.Start();<br/>
//...

I tried the firewall configuration, but i was not.

The stack trace is the following:

Server stack trace:
   at System.ServiceModel.Channels.HttpOutput.WebRequestHttpOutput.GetOutputStream()
   at System.ServiceModel.Ch

problem in socket connection

  
I had client and Server application, the server application to listern an a particular port. 500 clients are to connected and send the data to process everything fine.  At particular time i closed all clients and also close the server. when i start server after 10 mins at before 2 mins start all clients, very few clients(5-15) are connected. give me a solutiion.

Making a socket connection through a proxy.

  

Hi,

I've got an application in test where I create an internet socket that connects to a service over the inernet and receives a stream that I translte to XML files. So far so good. Now I'm told I need to be able to do this through a proxy server and am stumped. What am I missing, how do I do this? Thanks!

Mike 


The socket connection was aborted Exception

  

Hi All,

whenI use wcf, the client recorded the exception below.

if server and client deploy same computer the exception can't occur.

if server and client deploy different computer the exception can occur.

The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '01:40:29.2170000'.

I am perttymuch sure tat its not because of time out. I have given the config like this in client side and service side

 

NetTcpBinding tcpBinding = new NetTcpBinding();

tcpBinding.SendTimeout =

How to handle the socket connection was aborted communication exception.....

  

Hi All,

I keep getting the following exception and I would want to know how I can handle this. I am using NET TCP BINDING.

<Message>The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '10675199.02:48:05.4775807'.

Exception Detail:

System.ServiceModel.CommunicationException: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '10675199.02:48:05.4775807'. ---&gt; System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host

--- End of inner exception stack trace ---

at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)

at System.ServiceModel.Channels.FramingDuplexSessionChannel.EndTryReceive(IAsyncResult result, Message&amp; message)

at System.ServiceModel.Dispatcher.DuplexChannelBinder.EndTryReceive(IAsyncResult result, RequestContext&amp; requestContext)

at System.ServiceModel.Dispatcher.ErrorHandlingReceiver.EndTryReceive(IAsyncResult result, RequestContext&amp; requestContext)

</Message>

Network Error (tcp_error) A communication error occurred: "Connection refused"

  

I trying to execute my C# application from Visual Studio 2005 on a server that I'm remoted into.  I'm getting this error:

Network Error (tcp_error)

 

A communication error occurred: "Connection refused"

 

The Web Server may be down, too busy, or experiencing other problems preventing it from responding to requests. You may wish to try again at a later time.

 

 I can accsss the internet from the remote connection and I am not seeing this error anywhere else.  Does anyone know what might be causing this?  Thanks forany help.

Socket Connection Error

  

Hi All,

Am using socket connection to send and receive values. The following code is used to receive response.

  while ((sizeReceived = skt.Receive(bytesReceived, bytesReceived.Length, SocketFlags.None)) > 0)
                   {
                       nTotalBytes += sizeReceived;
                       sCleanresponse += Encoding.ASCII.GetString(bytesReceived, 0, sizeReceived);
                       //Giving time to read the remaining amount
                       System.Threading.Thread.Sleep(100);
                       if (skt.Available > 0)
                           continue;
                       else
                           break;
                   }


In the above code, am facing a prob in skt.Available. If i dont give the thread.sleep, it is not repeating the while loop and it exits after onetime. And if i dont give skt.Available line, sometimes it throws socket Exception. I do not want to use thread.sleep. Does anyone knows why this is happening and how can i resolve this? 


CommunicationException: The socket connection was aborted

  

I have a .NET 4.0 WCF service (Net.TCP) hosted in IIS 7.5.  Every once in a while I see Socket related errors on the server.  Is this a timeout issue?  How can I prevent this from happening?   

 

//This is the outer exception

TypeName: System.ServiceModel.CommunicationException

TypeAssembly: System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

Message: The socket connection was aborted. This could be caused by an error processing your message or a receive timeout being exceeded by the remote host, or an underlying network resource issue. Local socket timeout was '00:00:10'.

Source: System.ServiceModel

TargetSite: Int32 ReadCore(Byte[], Int32, Int32, System.TimeSpan, Boolean)

StackTrace:    at System.ServiceModel.Channels.SocketConnection.ReadCore(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout, Boolean closing)

   at System.ServiceModel.Channels.SocketConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)

   at System.ServiceModel.Channels.PreReadConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)

   at System.ServiceModel.Channels.DelegatingConnection.Read(Byte[] buffer, Int32 offset, Int32 size, TimeSpan timeout)

&nb

App to Support WebService and Socket Connection

  

Hi,

I have a scenario at my hand where in I have to build a WebApp/Control for implemeting the following two scenarios:

1. The Server app will be accesed by a device and based on the logic,  an XML is returned to the calling device. My solution is to implement a WebService for this.

2. The App also needs to communicate with another device for transfering the images, videos, audio, etc to the server app. The requirement from the client (who himself has a bit of Technically knowledge) end is to do it using the Sockets.

 

I am not sure if the same can be bundled into the same app. But have to do it somehow.

Any sort of inputs will be highly appreciated.

 

Cheers!!

Sumit Bhatnagar


Cheers!! Sumit Bhatnagar

Training Question - Connection Refused Error in Browsing A Cube In SSAS

  

I am an instructor for a data warehouse design and implementation course at a local college, and I have run into a problem that I have not been able to fix.  Hopefully someone out there can help.  It is the first time this course is being taught in a new lab where we are running SQLExpress 2008 Developer Edition, with a local server instance installed on each workstation, using Windows authentication; this configuration was done by our local LAN/network manager.  We have created a Management Studio source database and a Management Studio warehouse database, using a star schema design.  We have successfully created SSIS packages to extract from the source tables and populate the warehouse tables.  We have been able to create a DSV in SSAS.  When we attempt to process and browse the cube, it fails with a connection refused error from the server.  Configuration Manager tells me the SSAS server process is running.  The data connection works when checked.  We get the same error regardless of which impersonation option is selected. What have I missed?  Can the configuration be adjusted to get around this?  I have spent several hours trying everything I could think of, with no success - it is getting frustrating.

Please advise.  Thanks in advance.


SQL Connection String

  
We can learn or know how can we connect the database from our .net. This will help for freshers or .NET beginners!
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend