質問

SharePoint Infrastructureの下でサービス展開と戦っています。

ISAPI(_vti_bin)フォルダの下でREST SharePoint 2010 Webサービスを設定しようとしている時間をたくさん過ごしました。サービスは簡単な展開後に機能しますが、ユーザーの情報を取得する方法が見つかりません。

私はでアクセスしようとしました

  • spcontext.web.currentuser
  • servicesecurityContext.current.WindowsIdentity.Name
  • thread.currentPrincipal.Identity.Name

    しかし、毎回NULLでした。私のWebサービスにカスタムWeb.configを適用しようとしました。

    レイアウトの下で展開する問題を解決してください。

    • 2つのフォルダの違いは何ですか(動作中、私はすでにWebアプリケーション間の場所と配布を知っています)?
    • Webサービスの展開にISAPIが優先されるのはなぜですか?
    • レイアウトの下で展開する「良い習慣」はありますか?

      ありがとうございました

役に立ちましたか?

解決

If you deploy your web service to the layouts directory, you may run into some unexpected behavior with your web service.

ISAPI is the best practice location to deploy any custom web services. This is because this folder is set up to serve your web services via wswsdl and wsdisco.

As explained by James Tsai in his article Where do you deploy custom SharePoint web service files to?:

[The] _vti_bin (12\ISAPI) virtual folder has been configured to serve requests differently compared to other virtual folders in the SharePoint site.

Every web service request made to this directory will be parsed by wswsdl.aspx and wsdisco.aspx files in 12\ISAPI. wswsdl.aspx and wsdisco.aspx files then find correspondence (sic) wsdl and disco information for web service request and output correct contract reference and SOAP address.

...

Without this mechanism (web service request made to any other virtual folder on SharePoint site) the ASP.NET auto-generated disco and wsdl will be used. Since auto-generated disco and wsdl are unaware of the SharePoint service URL virtualization, results returned by web service become unreliable.

Check out the link for a test / proof of concept.

ライセンス: CC-BY-SA帰属
所属していません sharepoint.stackexchange
scroll top