Tuesday, 20 May 2008

Troubleshooting SPSite/SPWeb leaks in WSS v3 and MOSS 2007

Just wanted to make the community aware of a new blog just written by Stefan Gobner (EE Engineer at Microsoft and also a colleague of mine). He explain very well the steps that can be taken by SharePoint Administrators to isolate if a site that contains custom code, which does not properly dispose objects correctly and also how you can isolate components that are leaking these objects.

http://blogs.technet.com/stefan_gossner/archive/2008/05/07/troubleshooting-spsite-spweb-leaks-in-wss-v3-and-moss-2007.aspx

Keep up the great work Stefan your a living legend. :o)

Thursday, 15 May 2008

MOSS AntiVirus Guidelines

I find that a lot of companies implementing MOSS into their organisations are not really thinking about Antivirus software that is running at the Operating System level. There are a number of products out there talking about MOSS Antivirus plug in etc, but these plug in are checking for documents that are being pushed into MOSS for viruses.
MS Fore Front Security for SharePoint:

http://www.microsoft.com/forefront/sharepoint/en/us/product-overview.aspx

McAfee:

http://us.trendmicro.com/us/products/enterprise/portalprotect/index.html

But there seems to be a big area that companies are forgetting about, that can effect the stability of MOSS servers and cause a lot of issues that really confuse IT professionals. The OPERATING SYSTEM ANTIVIRUS. [;)]

To rule out any interference that the operating system antivirus software might bring to SharePoint's stability, the following exclusions from the antivirus real-time scan are recommended:

Windows 2003 Server

· The %systemroot% is normally the C:\WINDOWS or C:\WINNT directory depending on your OS· %systemroot%\System32\Spool (and all the sub-folders and files)· %systemroot%\SoftwareDistribution\Datastore· Any Network Drives that are mapped Refer to the following article for information:
KB822158 - Virus scanning recommendations for computers that are running Windows
Server 2003, Windows 2000, or Windows XP
http://support.microsoft.com/kb/822158

Internet Information Server

• The IIS compression directory (default compression directory is %systemroot%\IIS Temporary Compressed Files)
• %systemroot%\system32\inetsrv folder
• Files that have the .log extension

Refer to the following knowledge base articles for reference:
KB817442 - IIS 6.0: Antivirus Scanning of IIS Compression Directory May Result in 0-Byte File http://support.microsoft.com/kb/817442
KB821749 - Antivirus software may cause IIS to stop unexpectedly http://support.microsoft.com/kb/821749


SQL Server

• Exclude .MDF, .LDF, .NDF, .TRN, .BAK and .SLS
• Exclude sqlmangr.exe and sqlservr.exe
• SQL folder and databases files (or database file types) from scanning for performance reasons:

KB309422 - Guidelines for choosing antivirus software to run on the computers that are running SQL Server http://support.microsoft.com/kb/309422


WSS 3,0 / MOSS 2007

• Drive:\Program Files\Microsoft Office Servers\12.0
• Drive:\Program Files\Common Files\Microsoft Shared\web server extensions\12
• Drive:\DOCUME~1\ALLUSE~1\APPLICATION DATA\MICROSOFT\FIREWALL CLIENT\*
• Drive:\WINDOWS\Temp\WebTempDir\*
• Drive:\DOCUMENTS AND SETTINGS\\LOCAL SETTINGS\APPLICATION DATA\*
• Drive:\Documents and Settings\\\Local Settings\Temp\*
• Drive:\WINDOWS\system32\LogFiles
• W3wp.exe, cbd.exe, cidaemon.exe, owstimer.exe (WSS)
(where Drive: is the drive letter where you installed SharePoint Portal Server)



MOM

· Drive:\Documents and Settings\All Users\Application Data\Microsoft\Microsoft Operations Manager
· Drive:\Program Files\Microsoft Operations Manager 2005


If you are using Trend Micro the follow these guide lines:

• Temp folder: C:\Program Files\Trend Micro\PortalProtect\temp
• Quarantine folder, whose default location is:
Drive:\Program Files\Trend Micro\PortalProtect\Quarantine
• Backup folder, whose default location is:
Drive:\Program Files\Trend Micro\PortalProtect\Backup


The following link will provide you how you can configure MOSS anti-virus, not Operating System Anti-Virus.

http://technet2.microsoft.com/Office/f/?en-us/library/1289e6e2-03e0-4f10-8921-e516187891c61033.mspx


One of my recomendation before logging Microsoft PSS calls is to make sure you have these guidelines applied in your environment, this could save a lot of time & money with regard to support issues. I hope this helps. [:P]

I thought I would add this to the post; the offical KB article associated to "Folders may have to be excluded from antivirus scanning when you use a file-level antivirus program in Windows SharePoint Services 3.0 or in SharePoint Server 2007" has finally arrived: http://support.microsoft.com/kb/952167

Closing of the SPWeb or SPSite Object within Web Part Development

I wrote a base class for one of my clients and started to gather some web part information within my base class inheritted from my Web Part. I started to use the base class and it worked well, until I wanted to edit the web part and tried to change some of the properties attached to the web part. As soon as I applied the changes I would get an error of, "The SPWeb object is no longer valid". Looking through my code I realised I was explicitly closing the spweb object in a final statement. Code looked like this;


SPWeb oSite = SPControl.GetContextWeb(Context);
try
{
return oSite.ID.ToString();
}
catch (Exception exm)
{
throw new Exception(exm.Message);
}
finally
{
oSite.Dispose();
}


I removed the oSite.Disposed from my finally section and it all worked. [:D]

What I realised was that when you are using the Current Context to create a spweb object, you should not close or dispose of the object, or use it within a using statement, [using statement automatically call's the dispose method at the end of the using section] because other places within your site page will more then likely want to use this object. E.G when you want to change a property of a web part, etc...

There is a great article on MSDN that provides developers with best practices of disposing sharepoint services object.

Creating your own custom Base Class with your own MOSS Web Part

[;)] I had a requirement that required me to create a custom base for web parts to provide a common library for web part development within MOSS. I started to research on how this could be done and found very little information that explained the whole process of trying to achieve this and literally any form of reference to this topic in the 3.0 WSS SDK August 2007 did not exist. So I needed to do something to assist the development community.

So lets cut the chase and start showing you how this is done.

Firstly we need to create a new class project within Visual Studio and lets call this WebPartBase. In this example we will retrieve the webpart id and title of the webpart and place this in a protected string called WebPartID and WebPartTitle, I have also included some of the site properties into the base class. Our Base class will inherit from the System.Web.UI.WebControls.WebParts.WebPart base class, which is the base class Microsoft provide you to inherit for developing web parts. Our custom web part will inherit our custom base class, which for the purpose of the blog will only be two properties from the webpart and three properties from the Site object and place them into a strings. As soon as we inherit our base class we automatically inherit these strings into our web part. When we put this into perspective, you have the whole .Net framework their available to you as a developer that could be used as a library for comon tasks that you may require for all your web part development. e.g. Application Logging, Standardise on variable name's across your Line of Business applications for all web parts, custom behaviour across the board for all web parts, etc. I think you get the picture. [;)]

Lets Get Started.

1. Create New Class Project within Visual Studio 2005 and call this WebPartBase.

Add the following bit of code into your WebPartBase class so it should like something like this.

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;


using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;


namespace bobby.habib.base
{

public class PortletBase : System.Web.UI.WebControls.WebParts.WebPart
{
///


/// Public default constructor.
///

public PortletBase()
{

}

#region Web Part Settings

protected string WebPartID
{
get
{
return base.ID;
}
}

protected string WebPartTitle
{
get
{
return base.DisplayTitle;
}
}

#endregion

#region Site Settings

protected string SiteID
{
get
{
try
{
SPWeb oSite = SPControl.GetContextWeb(Context);
try
{

return oSite.ID.ToString();
}
catch (Exception exm)
{
throw new Exception(exm.Message);
}
finally
{
oSite.Dispose();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}

}
}

protected string SiteTitle
{
get
{
try
{
SPWeb oSite = SPControl.GetContextWeb(Context);
try
{

return oSite.Title;
}
catch (Exception exm)
{
throw new Exception(exm.Message);
}
finally
{
oSite.Dispose();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}

}
}

protected string SiteName
{
get
{
try
{
SPWeb oSite = SPControl.GetContextWeb(Context);
try
{

return oSite.Name;
}
catch (Exception exm)
{
throw new Exception(exm.Message);
}
finally
{
oSite.Dispose();
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}

}
}

#endregion



}
}


2. Complie this code. You will notice that we automatically will inherit a number of values that could be used, as part of your framework library for web part development.

WebPartID
WebPartTitle
SiteID
SiteTitle
SiteName
3. The next step is to now create a web part that will inherit from the custom base class we have just built, rather then using the System.Web.UI.WebControls.WebParts.WebPart base class. So lets create a new web part using visual studio, when creating your web part you must add a reference in your web part project to the custom base class we have just created.

Your web part project should look like this;

using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;

using bobby.habib.base;


namespace Bobby.Habib.WebParts.BaseTest

{

public class BobbyHTest : PortletBase
{
public BobbyHTest()
{
this.ExportMode = WebPartExportMode.All;
}

#region GUI Controls

// GUI Panels
private Panel _MainPanel;

#endregion



protected override void Render(HtmlTextWriter writer)
{
_MainPanel.RenderControl(writer);
}

protected override void CreateChildControls()
{

#region Control Declaration

_MainPanel = new Panel();

#endregion

Table outerTable = new Table();
outerTable.CellPadding = 0;
outerTable.CellSpacing = 0;
outerTable.Width = 400;

// Row 1

TableRow row = new TableRow();
TableCell cell = new TableCell();
cell.Width = 800;
string strTxT = string.Empty;
strTxT = strTxT + "Web Part Information
";
strTxT = strTxT + "base.ID - " + WebPartID + "
";
strTxT = strTxT + "base.Title - " + WebPartTitle + "
";
strTxT = strTxT + "Site Information
";
strTxT = strTxT + "Site ID - " + SiteID + "
";
strTxT = strTxT + "Site Name - " + SiteName + "
";
strTxT = strTxT + "Site Title - " + SiteTitle + "
";
strTxT = strTxT + "Display Title - " + WebPartTitle + "
";

cell.Text = strTxT;

row.Cells.Add(cell);
outerTable.Rows.Add(row);
_MainPanel.Controls.Add(outerTable);
base.CreateChildControls();
}
}
}


4. Compile the above code.

5. If you have the Visual Studio 2005 and have installed Visual Studio 2005 extensions for WSS3, you could go into the web part project properties and do the following;

In the Debug Tab in the project properties, click on the radio button that says "Start Browser with URL:" and enter the URL for your MOSS environment.
Assign a Strong Name Key to your base class and you could assign a Strong Name Key to your web part if you wouyld like to place this in the GAC.
In the SharePoint Solution Tab, complete the Solution, Feature and Element information. This behined the scences updates the values you enter in your solution, feature and element xml files that will be used during the deployment mechanism.
Hit F5 only and this will rebuild the project and deploy the solution into MOSS by creating a .wsp file and deploys the .wsp file.
6. You may need to copy your custom base class to the GAC, if you have not configured your solution files to copy the base class into the GAC. If during the time of deployment you find that the project starts error during the deployment. The likely cause is your web part cannot see the custom base class in the GAC and throws a reflection error. Ensure that the base class is in the GAC and is registred as a safe control in the web.config file of the site you are trying to deploy too.

7. Add the web part into a site page in MOSS and you will see the property values being displayed in the web part, that have been inherited from our custom base class.

I hope this helps a developer. [:P]

List Types & List Internal ID available within MOSS 2007

The following lists the default lists types and their internal sharepoint ID available in MOSS 2007. This references list can prove to be handy when creating your own Site Definitions, List Definitions and for Event Handlers:

Value Description

100 Generic List

101 Document Library

102 Survey

103 Links List

104 Announcement List

105 ContactsList

106 Events List

107 Tasks List

108 Discussion Board

109 Picture Library

110 Data Sources

111 Site Template Gallery

113 Web Part Gallery

114 List Template Gallery

115 XML Form Library

120 Custom Grid for a List

200 Meeting Series List

201 Meeting Agenda List

202 Meeting Attendees List

204 Meeting Decisions List

207 Meeting Objectives List

210 Meeting Text Box

211 Meeting things To Bring List

212 Meeting Workspace Pages List

300 Portal Sites List

1100 Issues Tracking

2002 Personal Document Library

2003 Private Document Library

One of the interesting points in the above list is the lack of numbering. You may have noted that 112 is not in the above list for example. But if you go to any Site Setting page within a MOSS site and in the Site Actions option click People & Group which takes you to a page that displays users and groups. Right hand click this page and view HTML source on this page. Schroll down to the bottom of the page and what you will notice is a hidden object in the HTML referencing the ListTemplate ID that displays the value of 112. INTERESTING! [;)]

MOSS Database Server Options

Backend Servers / SQL Server


Principally, MOSS and Windows SharePoint Services v3 use a SQL Server database to store all of its documents, web pages, and metadata. Another database is used to store the configuration detail of the portal. In fact, almost everything pertaining to SharePoint is stored in a SQL Server. This highlights the importance of the availability of the database and if this is not available your Portal is not available.
A high availability solution masks the effects of a hardware or software failure and maintains the availability of applications so that the perceived downtime for users is minimized. If there is a need for uninterrupted operation of an organization's SharePoint databases, it is recommended that a understanding of the high availability alternatives offered in SQL Server. With regard to SharePoint, SQL Server 2005 offers three high availability alternatives: log shipping, failover clustering, and database mirroring. Peer-to-peer replication is another SQL high availability alternative; however, it is not applicable to SharePoint.

Log Shipping

Log shipping is a recommended solution for creating redundant copies of databases from a source SQL Server to another target SQL Server. The normal procedure of log shipping involves the transaction logs being backed up from a source server (primary server), copied across to another target server (secondary server), and finally restored. To provide high availability for SharePoint mission-critical databases, log shipping is adequate because first, it is inexpensive, and second, it is relatively easy to administer. This is the most cost-effective method available for creating redundant databases compared to significantly higher costs associated with a hardware cluster. Unlike database mirroring, which is limited to a single destination server, when using log shipping, it is possible to configure more than one secondary server for redundancy. On the other hand, log shipping offers a slower and manual failover process that is not seamless. Therefore, log shipping might not be the best solution for providing an organization with high availability when compared to the Windows clustering and database mirroring approaches. All SharePoint database connections will also have to be manually changed to reflect the name of the new target SQL Server.

Windows 2003 and SQL Server 2005 Clustering

Windows Server 2003 and SQL Server 2005 support the shared-nothing cluster model. In a shared-nothing cluster, each node of the cluster owns and manages its local resources and provides nonsharing data services. In case of a node failure, the disks and services running on the failed node will failover to a surviving node in the cluster. However, with high availability clustering, only one node is managing one particular set of disks and services at any given time.
SQL 2005 on Windows 2003 Enterprise or Windows 2003 Datacenter can support up to eight nodes within a single cluster. Failover clustering of SQL Server 2005 can be configured in two ways: a single-instance failover (Active/Passive) configuration or a multiple-instance failover (Active/Active) configuration.
Single-Instance Failover Configuration
In a SQL Server single-instance failover configuration, the cluster runs a single instance of SQL Server on all nodes in the cluster. If the main SharePoint SQL Server instance fails on the primary node, the surviving node or nodes will run the same SQL Server instance. In this configuration, all the servers within a cluster share a master database along with a set of SharePoint databases, such as the configuration and content databases.
In the multiple-instance failover configuration, each of the active nodes has its own instance of SQL Server. Each instance of SQL Server includes a separate installation of the full service and can be managed, upgraded, and stopped independently. To apply a multiple-instance failover configuration, at least two instances of SQL Server must be installed on the cluster and each instance should be configured to run on a certain node as its primary server.

Database Mirroring

Database mirroring is a new high availability alternative introduced in SQL Server 2005. This solution increases database availability by maintaining an up-to-date copy of the source database on a hot standby server in real-time.
Database mirroring consists of two mandatory roles and a third optional role. The first mandatory role is the Principal Server, which contains the source database and is the source of all transactions. The secondary mandatory role is the Mirror Server, which is another server, one that focuses on receiving transactions from the principal server. The Witness Server is the third and optional role, which detects and enables automatic failover between the principal and mirror servers in the event of a failure.
Mirroring is implemented on a per-database basis and works only with databases that use the full recovery model. The simple and bulk-logged recovery models do not support database mirroring. Database mirroring is supported in SQL Server 2005 Standard Edition and Enterprise Edition.
Database mirroring offers a substantial improvement in availability over the previous high availability alternatives. Implementation is simplistic and it is straightforward to maintain. It is similar to log shipping; however, when a database mirroring session synchronizes, it provides a hot standby server that supports rapid failover with no loss of data from committed transactions. In addition, unlike log shipping, the failover is nearly seamless and client applications can recovery with minor interruption by reconnecting to the mirror server.

How to install SharePoint Server 2007 on a single machine

How to install SharePoint Server 2007 on a single machine

How to do a simple installation of SharePoint (with SQL 2005) on a single machine to be used for a stand-alone development, demonstration or simple 'play-pen' server (normally on a virtual machine).

This guide will outline all of the main steps to setup such an environment.
Please bear in mind that this is just an unofficial guide to getting SharePoint 2007 installed quickly and easily in a demo / test environment. This guide will not necessarily observe best practices with regard to security etc. For production setups, you should seek guidance from the official documentation which is available on TechNet (http://technet2.microsoft.com/Office/en-us/library/3e3b8737-c6a3-4e2c-a35f-f0095d952b781033.mspx?mfr=true).

Pre-Install

There are several things that you must do before you even insert the SharePoint 2007 CD they are:
Install Windows 2003 R2 with the latest service pack (2 at time of writing) and all of the latest Windows Updates. NOTE: Please do not use NewSID to change the SID of the machine if you are using a copy of another VM, this breaks things in SharePoint. My advice is to build Windows from fresh or to use Sysprep if you are using a copy of a VM.
Join your machine to a domain or create a domain by running DCPromo.exe from the Start > Run dialog. Install the .net frameworks v3.0 and v2.0 from Windows Update. You can also download the full redistributable packages if your server is not online. Install Windows 'Application Server' from Add/Remove Programs in Control Panel with default settings Prepare a service account in your active directory domain to use for all Sharepoint services. NOTE: Do not use the main domain\administrator account. This causes a problem if ever you wish to install Project Server 2007 on the same machine.
Give your service account local administrator rights and logon as this account throughout the entire installation process. Install SQL 2005 (and latest service pack) with typical settings. Assign your service account to the 'Security Administrators' and 'Database Creators' server roles in SQL server (You will need to use SQL Server Management Studio).

Base SharePoint Server Install

You are now ready to install SharePoint 2007 itself, follow these steps:
Login as your service account Insert your CD (or attach your ISO image) and run setup.exe if it does not autorun. NOTE: If you get an error about web service extensions here, ensure that 'ASP.net V2.0.50727' web service extension is allowed in IIS. If it is not in the list, perform a 'repair' on .net 3.0 framework using add/remove programs and then the web service extension will appear in the list. This is caused when IIS is installed after the .net framework
Enter your CD key and accept the license agreement. Choose 'Advanced' on the installation type dialog. NOTE: The definition of 'Advanced' means that you are using full SQL server (which may or may not be on the same machine). If you had selected 'Basic' then it would have installed the cut down version of SQL (MSDE).
Select 'Complete' on the Server Type screen and click 'Install Now'. The setup will now commence and you'll get a blue progress bar. Once installed you will get a screen with a check box that reads "Run the SharePoint products and Technologies Wizard now". Ensure this is ticked and click 'Close'. After a short pause, you'll get a 'Welcome' screen. Click 'Next'. You will get a warning that the wizard is about to reset several services, click 'Yes'. You'll be asked about the farm configuration, select to 'No, I want to create a new server farm'. Provide the database server (your server name) and your account details (account in the domain\user format). Leave the database name as the default. Click 'Next'. Leave the authentication mode as 'NTLM', set a specific port number is desired (not required) and click 'Next'. NOTE: In a production environment, you would most likely use Kerberos where possible (if your infrastructure supports it).
You'll get a summary screen; click 'Next' to kick-off the process. NOTE: If it fails here, it is most likely that you do not SQL setup correctly. Ensure your service account is in the right groups. Please also note that this section can take a very long time, especially step 2 (up to 45 minutes).
You'll get a success screen at the end, click 'Finish'. The wizard will attempt to load the central administration window. You may need to login here, use your service account. You may also get prompted to add the site to your trusted sites; go ahead and do that. NOTE: This authentication prompt is caused by the secure version of IE on Windows 2003 Server. You can turn if off by modifying the security settings in IE.

Services on Server Configuration

The first bit of configuration to do is set your server to host all services. You do not strictly have to enable all of these services, but I find it helps if you are using the machine to test / investigate functionality.
When the Central Administration screen appears, go to 'Operations' tab, then 'Services on Server'. Start the 'Document Conversions Load Balancer Service'. Start the 'Document Conversions Launcher Service', you'll have to choose the 'Load Balancer Server'; there should only be one option. If there are no options, ensure that the 'Document Conversions Load Balancer Service' has been started. Start the 'Excel Calculation Services'. Start the 'Office SharePoint Servers Search' service, observing the following guidelines: Tick both Query and Indexing check boxes Specify a contact email address (this can be any address) Enter your service account in the 'Farm Search Service Account' section Accept all other defaults and click 'Start' Leave all remaining services in their default configuration

Web Application Setup

The next stage is to create the 3 web applications that will be required to host the basic set of sites for a typical deployment, these are:
Shared Service Provider Administration Site (Recommended to be called 'SSPAdmin') My Site Host (Recommended to be called 'MySite') The Main Intranet (or 'Portal') Site (Recommended to be called 'Intranet') It is much simpler if all of these sites are on port 80 in IIS; this means that you do not have to remember to enter the ports all of the time. However having all three sites on port 80 means that each needs their own Host Header (required by IIS to differentiate between sites on the same port). The simplest way to do this is to create new 'Host (A)' records in DNS for each of your three sites. These should point to the IP address of your server; to do this follows these steps:
Open the DNS Management tool from Administration Tools on your domain controller Navigate to your DNS zone Create new 'Host (A)' record Enter the Host header (i.e. 'SSPAdmin', 'MySite' or 'Intranet') for the site and the IP address of your server Click 'Add Host' and repeat for each of the three sites Now the DNS entries are configured, we can create the three web applications in SharePoint; follow these steps for all three of your web applications (i.e. 'SSPAdmin', 'MySite' or 'Intranet'):
In Central Administration, go to the 'Application Management' tab Click 'Create or Extend Web Application' and then click 'Create a new Web Application' Fill out the new web application screen observing the following points: Change the New IIS Site description to read something like 'SharePoint – 80 - ' where is the name of the web application your are creating (i.e. 'SSPAdmin', 'MySite' or 'Intranet') Ensure the 'Port' is set to 80 Set the 'Host Header' to match the DNS record you created (i.e. 'SSPAdmin', 'MySite' or 'Intranet') Change the 'Application Pool Name' to match the 'New IIS Site Description' Enter your service account for the Application Pool account settings Change the 'Database Name' to read something like 'WSS_Content_' where is the name of the web application your are creating (i.e. 'SSPAdmin', 'MySite' or 'Intranet') Leave all other settings on default and click 'OK' Repeat for all three web applications (i.e. 'SSPAdmin', 'MySite' or 'Intranet')
Shared Service Provider Setup
The next stage is to create the Shared Service Provider (SSP). The SSP is required in order to provide several key services such as Search or My Site. To configure the SSP, follow these steps:
In Central Administration, go to the 'Application Management' tab In the 'Office SharePoint Server Shared Services' section, click 'Create or Configure This Farms' Shared Services' Click 'New SSP' Fill out the 'New Shared Services Provider' screen observing the following guidelines: For the 'SSP Administration Site' web application (the first one you get asked for), choose the web application that you created earlier (suggested name was 'SharePoint – 80 - SSPAdmin') For the 'My Site Location' web application (the second one you get asked for), choose the web application you created earlier (suggested name was 'SharePoint – 80 - MySite') Enter your service account for the 'SSP Service Credentials' Leave all other settings on default and click 'OK' The creation of an SSP can take some time (up to 1 hour on a virtual machine). When it is finished you will see a 'Success!' screen, Click OK. Collaboration Portal Site Collection Setup
The next stage is to create a collaboration portal which is one of the more feature-filled site types and represents a typical intranet environment. To do this, follow these steps:
In Central Administration, go to the 'Application Management' tab In the 'SharePoint Site Management' section, choose 'Create Site Collection' Fill out the 'Create Site Collection' observing the following guidelines: Ensure you have selected the 'Intranet' web application you created earlier (suggested name was 'Intranet') Give your site a title ('Intranet' is suggested) In the 'Template Selection' section, choose 'Collaboration Portal' from 'Publishing' tab Enter you service account for the 'Primary Site Collection Administrator' Leave all other settings on default and click 'OK' When the 'Top-Level Site Successfully Created' message appears you have created the site, simply click the link that is provided (something like http://intranet/)

Configure Indexing

The final step of the process is to configure indexing so that you have some search results. Though this step is optional, it is recommended as it will enable you to use the powerful search capabilities of SharePoint. To configure the index, follow these steps:
In Central Administration, click the 'SharedServices1' link on the left-side navigation (or whatever you name your SSP) When the SSP Administration site appears, click on 'Search Settings' in the 'Search' section On the 'Configure Search Settings' page, click 'Content Sources and Crawl Schedules' Edit the 'Local office SharePoint Server Sites' content source by hovering your mouse over it and choosing 'Edit' Fill out the 'Edit Content Source' observing the following guidelines: Set a full crawl schedule to be at least once a day Set a incremental crawl schedule for every 10 minutes Tick the 'Start Full Crawl of this Content Source' tick-box Click 'OK' A crawl will now start. Initial crawls normally take up to 10 minutes. The process is now complete. User should be able to access the main collaboration portal from http://intranet/ (or whatever you called the DNS record).
I hope this was useful, because it was for me.

MOSS - Error : Unable to find an entry point named 'OshFGetSafeHtmLAllocForManaged3' in DLL 'osafehtm.dll'

This is not a pretty error and can make you run around the house's trying to figure out what the hell is going on. [:S]
The exception tend to occurs when you try to publish changes on a site page within MOSS.
You normally see the following error stack:
“Application error when access /_layouts/AddNavigationLinkDialog.aspx, Error=Unable to find an entry point named 'OshFGetSafeHTMLAllocForManaged3' in DLL 'osafehtm.dll'. at Microsoft.SharePoint.Publishing.Fields.SafeHtmlWra[:O]pper.NativeMethods.OshFGetSafeHTMLAllocForManaged3(Byte[] htmlSourceBytes, Int32 htmlSourceBytesSize, Int32 htmlSourceCodePage, Byte** htmlReturnedBytes, Int32& htmlReturnedBytesSize, Int32 convertToDestinationCodePage, Int32 safeHtmlBehaviorFlags, String[] tagsToHandle, Int32[] tagHandlingFlags, Int32 tagHandlingCount, Int32& tagHandlingResultFlags, EditOrDropUrlsDelegate urlHandlingCallback, Boolean& isSafeHtml) at Microsoft.SharePoint.Publishing.Fields.SafeHtmlWrapper.GetSafeHtml(String stylecopStringUnsafeHtml, Int32 safeHtmlBehaviorFlags, Hashtable tagsAndFlags...”Now I have seen a lot of people using a temporary work around for this which is, to run from a command line "psconfig.exe -cmd secureresources" and then a iisreset. Well this is interesting because this seems to cure the issue for about 24 hours and then the issue seems to arise again. Oh my god! The business impact this must be having on some of the companies out there. [:O] Now the secureresources command performs SharePoint Products and Technologies resource security enforcement on the server. For example, security is enforced on files, folders, and registry keys. So why would something like this cure the issue for about 24 hours. I was amazed. [:O]
So lets look at this in a bit more detail. The stack trace shows an error with OshFGetSafeHTMLAllocForManaged3 which tells us that the dll used here is osafehtm.dll. This dll is a MOSS wrapper assembly used with the HTML controls on site pages and is used widely across the MOSS UI pages.
The OshFGetSafeHTMLAllocForManaged3 function is used mainly when there are pages that are using image or hyperlink HTML controls on a page. Also to note that the osafehtm.dll resides in the following directory in MOSS C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN\ directory. When I looked closely at the server configuration which the exception occurred I also noticed C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\BIN\ directory. And as soon as I took a peak in this directory I noticed the office 11 version of the osafehtm.dll in this directory. Bingo! Renamed the file to z_osafehtm.dll and ran a iisreset /restart the error never did occur again. [:P] Infact I renamed the 60 directory to z_60.
So here's the logic:
1. The error seems to only occur on configurations that have been upgraded from SPS2003 to MOSS.
2. With the upgrade both the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN\ and C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\BIN\ are defined paths, which means the incorrect dll can be loaded.
So why does it work for 24 hours after you run psconfig.exe securedresources and a IISReset:
I think this is because the secured resources must force 12\bin directory path to be read and loads the correct version of the osafehtm.dll assembly and the IISReset will reset all cached assemblies that are loaded in memory or cached by IIS. Within 24 hours the Application Pool will recycle itself if the default setting for the application pook are configured and at this point there are two different versions of the assembly that now can be loaded because the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\60\BIN\ is also a defined path and MOSS then loads the incorrect version of osafehtm.dll.