Error in Calling some service in WCF Client

93 views Asked by At

When I call this service method:

StaffServiceClient _Service = new StaffServiceClient();
Table_StaffInfo item = _Service.GetStaffById(10);

I get an error:

An error occurred while receiving the HTTP response to http://localhost:8008/StaffService. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details.

but when i call another service method:

StaffServiceClient _Service = new StaffServiceClient();
List<spStaffList_Result> list = _Service.GetStaffList().ToList();

the program works.

1

There are 1 answers

1
nvoigt On BEST ANSWER

Your method GetStaffById failed internally. Maybe it has problems with receiving data (unlikely if just an int) maybe it has problems sending data (does your type Table_StaffInfo feature DataContract / DataMember attributes?) or it simply threw an exception.

You will need to debug your service. Put a breakpoint in the method and see where it takes you.

For starters, ignore the int parameter and just put a return null; in the method. If that works, it has nothing to do with your connection or server setup and you need to debug your code.