I have a model for using as a parameter of the post method.
My model is:
public class SendObject
{
public string Id { get; set; }
public string Body { get; set; }
public string Subject { get; set; }
public SendObjectParameters Parameters { get; set; }
public object[] Attachments { get; set; }
}
public class SendObjectParameters
{
public string Id { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public string Address { get; set; }
}
I have an attachment that I want to send with Attachments = new[] { attachment }
My attachment is an excel file and the type of attachment is FileStreamResult
.
In the post method, I try to serialize this object like string content = JsonConvert.SerializeObject(sendContent);
. And I get an error right there about serializing : Newtonsoft.Json.JsonSerializationException: Error getting value from 'ReadTimeout' on 'System.IO.MemoryStream'. ---> System.InvalidOperationException: Timeouts are not supported on this stream.
How can I fix this?