Trying to migrate a legacy .net site from a SharePoint 2010 farm to SharePoint 2016. Simple IIS site that has one page for testing.
Run the site in IIS Express and everything works. Run the same site in IIS and I receive an Access Denied error.
SPSecurity.RunWithElevatedPrivileges(Function() doSP(hURL))
Function doSP(hURL As String)
Using hSite As New SPSite(hURL)
Using hWeb As SPWeb = hSite.OpenWeb()
Dim listItems As SPListItemCollection = hWeb.Lists("testx").Items
Dim item As SPListItem = listItems.Add()
item("Title") = "test1"
item.Update()
End Using
End Using
End Function
App pool is running as my account and I also tried using the farm account. My account is granted Full Control to the SharePoint web app via User Policy. Also granted my account Site Collection Admin permissions.
Full error:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))