无法将“ServiceReference1.EmployeeModel”类型的对象转换为“System.IConvertible”类型。究竟是什么高于错误,为了避免它我们必须做什么?
protected void btnCreate_Click(object sender, EventArgs e)
{
JavaScriptSerializer jsn = new JavaScriptSerializer();
WebRequest request = WebRequest.Create("localhost:50506/Service1.svc/CreateEmployee";);
request.Method = "POST";
request.ContentLength = 10;
EmployeeModel emp = new EmployeeModel(); //i added emp fields in to emp
Byte[] data = { Convert.ToByte(emp) };
Stream requestStream = request.GetRequestStream();
requestStream.Write(data, 0, data.Length); //in Byte[] data line the error is coming
}