با درود و عرض ادب
دوستان من یه وب سرویس احتیاج دارم که مقدار بازگشتیش به صورت Json باید باشه
using System.Collections.Generic;using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.ServiceModel.Web;
namespace HRJSOFT_Sana_WCF_plus
{
public class Service1 : IService1
{
public List<IpVisitors> GetAllIPS()
{
List<IpVisitors> IPList = new List<IpVisitors>();
using (SqlConnection conn = new SqlConnection())
{
conn.ConnectionString = ConfigurationManager.ConnectionStrings["sql"].ConnectionString;
using (SqlCommand cmmd = new SqlCommand("dbo.Sana_www_Sp_xxx", conn))
{
cmmd.CommandType = CommandType.StoredProcedure;
cmmd.Parameters.AddWithValue("@_Layer", 1);
using (SqlDataReader sdr = cmmd.ExecuteReader())
{
while (sdr.Read())
{
IPList.Add(new IpVisitors
{
Ip = sdr["cdate"].ToString(),
Number = sdr["list"].ToString()
});
}
}
}
}
return IPList;
}
public class IpVisitors
{
public string Ip { get; set; }
public string Number { get; set; }
}
}
}




using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using static HRJSOFT_Sana_WCF_plus.Service1;


namespace HRJSOFT_Sana_WCF_plus
{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
[ServiceContract]
public interface IService1
{


[OperationContract]
[WebInvoke(Method = "GET", RequestFormat = WebMessageFormat.Json,
ResponseFormat = WebMessageFormat.Json, UriTemplate = "/iplist/")]
List<IpVisitors> GetAllIPS();


// TODO: Add your service operations here
}
}

اما تو مقدار بازگشتی خطای The server encountered an error processing the request. See server logs for more details. رو صادر میکنه