Home | Blog | Screencasts | Projects
# Sunday, March 15, 2009

If your coming to SharePoint from a non .NET developer world, the web.config file might be a confusing and daunting file. I’ve broken out the major sections that any SharePoint administrator or newbie developer should know:

 

CallStack: By default SharePoint will display a nice friendly error message:

image

But this will often be a vague message that isn’t really helpful in troubleshooting the real problem. To enable a detailed error message, find the following line in your web.config file:

 

<SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

 

Then change the CallStack="false" to CallStack="true" This should also be coupled with another change in the web.config file:

 

Custom Errors:

The default will be to show custom errors, this will hide the ‘yellow screen’ that is the ASP.NET error reporting page:

 

image

 

<customErrors mode="On" />

 

By changing mode="On" to mode="Off" The yellow screen will be enabled, which should provide a more detailed report of the error.

 

Safe Controls:

SharePoint has measures in place that ensures that only trusted controls are used throughout the system. SharePoint will only load controls that have a SafeControl entry in the web.config file. Normally the SharePoint solution will write these entries in the web.config file, which is under administrative control (because an administrator is deploying it). But often a developer won’t worry about packaging up a control if they are still developing, so they need to manually add a control to the Safe Controls section of the web.config file, a typical entry looks like:

 

<SafeControl Assembly="Microsoft.SharePoint.Portal, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.Portal.WebControls.Alerts" TypeName="*" Safe="True" />

 

Blob cache:

A SharePoint administrator should be aware of the next setting, because it can increase the performance of your site. The idea is that SharePoint will write any images, CSS or JS to a folder on disk rather than requesting the file from the content database. The following entry should be modified to enable the blob cache (more info here).

 

<BlobCache location="C:\blobCache" path="\.(gif|jpg|png|css|js)$" maxSize="10" enabled="false" />

 

To enable the blob cache, change enabled="false" to enabled="true" and make sure that the location exists.

 

Trust level:

Another important concept that new developers need to come to terms with is that by default SharePoint will run under a custom trust level called ‘WSS_Minimal’. This means that they can’t deploy assemblies into the ‘bin’ directory, with the ‘WSS_Minimal’ setting they would need to deploy to the GAC. Normally in a development environment where the developer is constantly changing and testing the code, they will want to change the following line:

 

<trust level="WSS_Minimal" originUrl="" />

 

to: <trust level="Full" originUrl="" />

 

Proxy Settings:

Often in a corporate environment a proxy server will sit between your SharePoint farm and the internet. So operations like retriving external RSS feeds will not work with some configuration changes. The web.config file can be used to store the proxy information, by default the section will look like:

 

<system.net>
    <
defaultProxy>
      <
proxy autoDetect="true" />
    </
defaultProxy>
  </
system.net>

 

to add a new proxy:

 

<system.net>
    <
defaultProxy>
      <
proxy useSystemDefault="false" proxyaddress="http://proxy" bypassonlocal="false"/>
    </
defaultProxy>
  </
system.net>

 

Hopefully now the web.config file isn’t such a mystery for the new SharePoint administrator or developer.

Sunday, March 15, 2009 3:17:00 AM (E. Australia Standard Time, UTC+10:00)  #    Comments [0] - Trackback
Sharepoint | Tip
Statistics
Total Posts: 191
This Year: 0
This Month: 0
This Week: 0
Comments: 41