I am deploying a unity build into HoloLens I do not know why I am getting this error, it works fine on Unity editor but when deploying to HoloLens it throws the following error:
ArgumentException: Value does not fall within the expected range.
System.Net.Sockets.Socket.SetSocketOption (System.Net.Sockets.SocketOptionLevel optionLevel, System.Net.Sockets.SocketOptionName optionName, System.Int32 optionValue)
This is my piece of code
try {
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(apiURL);
httpWebRequest.Method = "POST";
httpWebRequest.ContentType = "application/json";
using (StreamWriter streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()
))
streamWriter.Write("{ \"config\": { \"languageCode\" : \"en-US\" }, \"audio\" : { \"content\" : \"" + file64 + "\"}}");
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
After debugging I've determined this is the line that is throwing the error
httpWebRequest.GetRequestStream()
Please can anyone help!?!