문제

IIS SharePoint 웹 사이트에서 호스팅되는 ASP.NET 응용 프로그램을 상속합니다.IIS에서 웹 사이트를 마우스 오른쪽 단추로 클릭 한 다음 '응용 프로그램 추가'를 클릭하십시오. 여기에서 사용되는 방법입니다.

응용 프로그램의 '소유자'가 설정 한 데프 서버에서 SPContext가 우리가 기대할 때 SPContext가 채워집니다.그러나 프로덕션에서 spContext는 null입니다.

또한 내 테스트 SharePoint 웹 응용 프로그램을 만들었으며 SpContext 문제를 테스트하기 위해 표준 Visual Studio ASP.NET 웹 응용 프로그램을 추가했습니다 ... 불행히도 spContext는 null입니다.

dev 서버

기존 앱 : spContext!= null

테스트 응용 프로그램 : spcontext== null

prod 서버

기존 응용 프로그램 : spcontext== null

테스트 응용 프로그램 : spcontext== null

spContext가 채워지는 데 필요한 것이 누락되어 있습니까?spcontext.getContext (httpContext.current)를 시도했지만 spcontext.web는 null입니다.아이디어?

도움이 되었습니까?

해결책

Immediately after posting this, I had an idea. None of the web applications that are failing have a "Root" site collection. Technically there is no such thing as a root site collection, but I created one in the Prod Server > Existing App (at the '/' managed path) and things magically started working.

So it seems that SPContext somehow is defaulting to WebApplication.Sites[0]

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 sharepoint.stackexchange
scroll top