I am using Newtonsoft.Json dll for Serialize object to return string from wcf service. When I call other simple method from service it works fine but when I call method which serialize object into string and return that string its not working. Below is my code of service.
public string GetString()
{
return "Hello";
}
public string GetData(int i)
{
My_Entities ME = new MY_Entities();
ApplicationVM oVM = new ApplicationVM()
{
AP_M_BloodGroup = ME.AP_M_BloodGroup.ToList().ElementAtOrDefault(i),
AP_M_DayMaster = ME.AP_M_DayMaster.ToList().ElementAtOrDefault(i)
};
return JsonConvert.SerializeObject(oVM, Formatting.Indented);
}
Both method work for local but after hosting when calling GetData()
method it will give error message "Access Denied"
at client side.
So, what is the problem and what I need to put extra?
When I put client side code in try-catch block it gives message like:
Message: Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed
ApplicationVM
doing? is it accessing some resources? what identity is you application pool running under? – AndrewGetData
method? What credentials are you using to connect to your database? first method simply returns an constant - that has nothing to say. – Andrew