Experiencing problem above after two web parts on the same aspx page deploy. Both parts use this code:

using (var portal = new SPSite(SPContext.Current.Site.Url))
                using (SPWeb web = portal.OpenWeb())
                    _settingsList = web.Lists[SettingsListName];

                    var query = new SPQuery

User fails to load page with error

"Attempted to make calls on more than one thread in single threaded mode. (Exception from HRESULT: 0x80010102 (RPC_E_ATTEMPTED_MULTITHREAD))"

Appreciate any suggests.

  • Are you elevating code somewhere? Do you have any static objects? May 12, 2015 at 13:10
  • I don't use any elevations but actually my _settingsList is static. May 12, 2015 at 13:29
  • Seems work fine after removing all static fields and wraps! It helped me) Amal, thanks a lot May 12, 2015 at 14:44

1 Answer 1


If you have Static objects then the associated SPSite/SPWeb/SPList object will get used by different threads (in your case two web part code might get executed in different threads).

Hence to resolve you can try removing static.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.