/// ----------------------------------------------------------------- /// <summary> /// </summary> // ----------------------------------------------------------------- private byte[] HandleBinaryRequest(string domain, Stream bstream, IOSHttpRequest request, IOSHttpResponse response) { response.ContentType = "application/bson"; response.StatusCode = 200; response.KeepAlive = true; ResponseBase resp = null; try { RequestBase req = RequestBase.DeserializeFromBinaryStream(bstream); if (req == null) { resp = OperationFailed("Failed to deserialize request"); return(resp.SerializeToBinaryData()); } // Check to see if this is an authentication request // Get a complete domain and find the handler if (String.IsNullOrEmpty(req._Domain)) { req._Domain = domain; } resp = InvokeHandler(req); } catch (Exception e) { resp = OperationFailed(String.Format("Fatal error; {0}", e.Message)); } return(resp.SerializeToBinaryData()); }