My function requires an iis reset every 15-20 requests.
I created this CLR class to pull data from my web service. Every 15-20 times it run it requires an IIS reset. Am I missing a dispose someplace? See code below
I created this CLR class to pull data from my web service. Every 15-20 times it run it requires an IIS reset. Am I missing a dispose someplace? See code below
Code:
public class SharePointCalendar
{
[SqlFunction(SystemDataAccess = SystemDataAccessKind.Read, FillRowMethodName = "GetCalendarItemInfo")]
public static IEnumerable GetCalendarItems(SqlString url, SqlString listName)
{
DataTable t = new DataTable();
WindowsImpersonationContext ctx = null;
WindowsIdentity id = SqlContext.WindowsIdentity;
try
{
ctx = id.Impersonate();
WSS.Lists svc = new WSS.Lists();
svc.Url = url.ToString();
svc.Credentials = CredentialCache.DefaultNetworkCredentials;
XmlNode node = svc.GetListItems("Leasing Overview", null, null, null, "100000", null, null);
XmlTextReader rdr = new XmlTextReader(node.OuterXml,XmlNodeType.Element, null);
DataSet ds = new DataSet();
ds.ReadXml(rdr);
t = ds.Tables[1];
}
finally
{
if (ctx != null)
ctx.Undo();
}
return t.Rows;
}
public static void GetCalendarItemInfo(
object obj,
out SqlString SiteID,
out SqlString PropName)
{
DataRow r = (DataRow)obj;
SiteID = new SqlString(r["ows_Site ID"].ToString());
RLM = new SqlString(r["ows_prop name"].ToString());
}
}