We are using Microsoft.Exchange.WebServices we have 30+ User. Some user get this
Only one usage of each socket address (protocol/network address/port) is normally permitted XX.XXX.XXX.XXX:443
Error. when they try to delete mail. My code is below i can't understand what's wrong please help if you know.
ExchangeService esb = new msExchange.ExchangeService(msExchange.ExchangeVersion.Exchange2007_SP1);
esb.Credentials = new NetworkCredential(username, password);
esb.Url = new Uri("URL");
int i = 0;
foreach (var item in emailId)
{
itemIds[i] = new msExchange.ItemId(item.MsgId);
i++;
}
ServiceResponseCollection<msExchange.ServiceResponse> deleteResponse = esb.DeleteItems(itemIds, msExchange.DeleteMode.HardDelete, msExchange.SendCancellationsMode.SendToNone, msExchange.AffectedTaskOccurrence.AllOccurrences);
Microsoft.Exchange.WebServices.Data.ServiceRequestException: The request failed. Unable to connect to the remote server ---> System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted xx.xxx.xxx.xxx:443 at System.Net.Sockets.Socket.InternalEndConnect(IAsyncResult asyncResult) at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) --- End of inner exception stack trace --- at System.Net.HttpWebRequest.GetResponse() at Microsoft.Exchange.WebServices.Data.EwsHttpWebRequest.Microsoft.Exchange.WebServices.Data.IEwsHttpWebRequest.GetResponse() at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request) --- End of inner exception stack trace --- at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.GetEwsHttpWebResponse(IEwsHttpWebRequest request) at Microsoft.Exchange.WebServices.Data.ServiceRequestBase.ValidateAndEmitRequest(IEwsHttpWebRequest& request) at Microsoft.Exchange.WebServices.Data.SimpleServiceRequestBase.InternalExecute() at Microsoft.Exchange.WebServices.Data.MultiResponseServiceRequest1.Execute() at Microsoft.Exchange.WebServices.Data.ExchangeService.InternalDeleteItems(IEnumerable1 itemIds, DeleteMode deleteMode, Nullable1 sendCancellationsMode, Nullable1 affectedTaskOccurrences, ServiceErrorHandling errorHandling, Boolean suppressReadReceipts) at Microsoft.Exchange.WebServices.Data.ExchangeService.DeleteItems(IEnumerable1 itemIds, DeleteMode deleteMode, Nullable1 sendCancellationsMode, Nullable1 affectedTaskOccurrences, Boolean suppressReadReceipt) at Microsoft.Exchange.WebServices.Data.ExchangeService.DeleteItems(IEnumerable1 itemIds, DeleteMode deleteMode, Nullable1 sendCancellationsMode, Nullable1 affectedTaskOccurrences)
According to my search, This error might be address already in use.
Typically, only one usage of each socket address (protocol/IP address/port) is permitted. This error occurs if an application attempts to bind a socket to an IP address/port that has already been used for an existing socket, or a socket that was not closed properly, or one that is still in the process of closing. For server applications that need to bind multiple sockets to the same port number, consider using setsockopt (SO_REUSEADDR). Client applications usually need not call bind at all—connect chooses an unused port automatically. When bind is called with a wildcard address (involving ADDR_ANY), a WSAEADDRINUSE error could be delayed until the specific address is committed. This could happen with a call to another function later, including connect, listen, WSAConnect, or WSAJoinLeaf.
For more information, Please refer to this link: