SharePoint仮想ディレクトリへのASP.NET Webアプリケーションの追加(SPContext用)
-
09-12-2019 - |
質問
IIS SharePoint Webサイト内でホストされているASP.NETアプリケーションを継承しています。IISから、Webサイトを右クリックし、[アプリケーションの追加]をクリックすることがここで使用される方法です。
私たちのDEVサーバーでは、アプリケーションの「所有者」が設定されている場合、SPContextは私たちが期待されるようになるので入力されています。ただし、製造では、SPContextはnullです。
私は自分のテストSharePoint Webアプリケーションを作成しました。
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]