Handling WCF Server / Client Connection

I am having trouble connecting to WCF server and client.

If I normally use my service and client, i.e. my client connects and disconnects via normal operations (myclient.Close ()), everything works fine. But in the case where my server is running and I use the stop button of visual studio to exit my client application, my communication with the server and client seems to be useless and the server does not clear the connection correctly and no new connections from my client are very are unstable, and only certain function calls work until one of the functions throws an exception:

System.ServiceModel.CommunicationException: An error occurred while receiving an HTTP response to http: // localhost: 8080 / Design_Time_Addresses / Service_Beta1 / Service . This could be due to a non-HTTP service endpoint binding. It could also be due to the HTTP request server being interrupted, and possibly due to a service outage. See Server Logs for details. ---> System.Net.WebException: The underlying connection was closed: An unexpected error occurred while getting.

And there are many more exceptions after that, and I'll spare you reading.

If I stop the server and client and restart both, all my calls will work fine until I do an abrupt Stop in visual studio. How do I force the server to clean up improperly closed connections? I know that in production the Stop button is gone and in theory there should be no problem, but I don't want to have problems connecting to the server from client crashes or bad disconnections. Because there will inevitably be those cases. Your best bet is to fix this now, before you have 20 more clients trying to connect and getting exceptions.

thank

-1


source to share


1 answer


Sorry for taking so long to post a response. My problem is that I was returning data for the client, but did not give the tables a name when I created it. See below.



Dim dt As New DataTable() 'Passing just a blank un-named table to client gave errors.
Dim dt As New DataTable("Table") 'Naming the table like so passes just fine.

      

-2


source







All Articles