Microsoft KB Archive/832813

= Performance of Web Parts decrease when you use the Windows SharePoint Services object model in a Web Part =

PSS ID Number: 832813

Article Last Modified on 12/17/2003

-

The information in this article applies to:


 * Microsoft Windows SharePoint Services

-





SYMPTOMS
When you use the Microsoft Windows SharePoint Services object model in Web Parts that are installed to the Bin folder of a Microsoft Windows SharePoint Services Web site, the performance of the Web Parts may decrease.



CAUSE
This issue occurs because Web Part assemblies that are located in the Bin folder are not assigned a full trust. Code Access Security in Microsoft .NET Frameworks is optimized in situations where all assemblies that are currently loaded are assigned a full trust. In situations where a partially-trusted assembly is loaded, code access security operations are performed, and the occurrence of stack walks increase. These operations result in a decrease in performance when you access Web Parts.



RESOLUTION
To troubleshoot and resolve this issue, do one or more of the following, as appropriate to your situation:
 * Move the assemblies to the Global Assembly Cache (GAC), where by default, the assemblies are assigned a full trust.
 * Modify the Web.config file so that all components are fully trusted.
 * Modify the policy file so that all assemblies in the Bin folder are assigned a full trust.
 * Use a profiler to understand where the stack walks occur, and then reduce those stack walks.

For example, cache certain values or assert certain permissions that can reduce the amount of work that each stack walk performs.
 * Modify the code of the custom Web Part so that it asserts object model permissions at the appropriate time.

By doing so, you may be able to reduce the decreases in performance to approximately 15 percent degradation.



MORE INFORMATION
For additional information about the Windows SharePoint Services object model, see the Microsoft Windows SharePoint Services Software Development Kit (SDK). To obtain the Windows SharePoint Services SDK, visit the following Microsoft Web site:

http://www.microsoft.com/downloads/details.aspx?FamilyID=1c64af62-c2e9-4ca3-a2a0-7d4319980011&displaylang=en

For more information about Windows SharePoint Services, visit the following Microsoft Web site:

http://www.microsoft.com/windowsserver2003/technologies/sharepoint/default.mspx

Additional query words: wss

Keywords: kbprb KB832813

Technology: kbSharePtWinSvc

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© 2004 Microsoft Corporation. All rights reserved.