摘要:[MOSS 2007] 解决Operation is not valid due to the current state of the object.
Description: When writing a Web Service, use to produce news SPSecurity.RunWithElevatedPrivileges
solve:
The original
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite("http://SiteUrl"))
{
using (SPWeb web = site.OpenWeb())
{
......
}
}
});
Changed
SPWeb web = null;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite("http://SiteUrl"))
{
web = site.OpenWeb();
......
}
});
web.Dispose();
That is, SPWeb independent, not on the inside SPSecurity.RunWithElevatedPrivileges
Original: Large column [MOSS 2007] resolve of Web Service Operation is not valid due to the current state of the object.