Saturday, July 31, 2010

DomainOperationException Overriding Custom Exceptions


We ran into a rather silly issue with a recent Silverlight deployment. In our RIA services is it not uncommon for use to throw custom exceptions from the RIA side and then have our Silverlight application display them to the user.

For instance we would throw a custom exception if there was an issue with the login and we would expect the following to be "User and password is invalid" to be displayed. However we were getting "Load operation failed for query 'Login'. Exception of type 'System.ServiceModelServices.Client.DomainOperationException' was thrown."

What we noticed is anytime we through a custom exception it was being returned as DomainOperationException instead of the custom exception type. This drove us nuts because it was working in each of our development environments but not on this integration machine we were using for testing. We did some searches on DomainOperationException but really could not find much that helped. We did find this blog ( however it was poorly written.


Well the solution was really simple. All we had to do was make the following modification to our web.config where the RIA Services were hosted.

<customErrors mode="Off"/>

Saturday, July 10, 2010

SharePoint LINQ Query Error


If you are using the new Microsoft.SharePoint.Linq API for SharePoint 2010 web parts you may run into the following problem. Here is some code:

TeamSiteDataContext context = new TeamSiteDataContext(SPContext.Current.Web.Url);

TeamSiteDataContext context = new TeamSiteDataContext(SPContext.Current.Web.Url);
EntityList<Task> tasks = context.GetList<Task>("Tasks");

DateTime? queryDate = new DateTime(2010, 7, 16);

var results = from tsk in tasks
where tsk.DueDate == queryDate
select tsk;

spGridView.DataSource = results;

All I am doing is running a LINQ query for tasks. This code will give the following error:

One or more field types are not installed properly. Go to the list settings page to delete these fields.


While researching this, I found that if I got rid of the DueDate, the error would go away but that was not an acceptable solution. I did some research on and could not find anything on SharePoint 2010, as this was an issue you could have when writing SPQuery in older versions of SharePoint.

The ultimate solution was to change the second line to the following:

EntityList<TasksTask> tasks = context.GetList<TasksTask>("Tasks");

The reason is I used SPMetal to generate the proxy to SharePoint 2010. In the generated class there will be a Task and TasksTask classes. The Task maps to the generic content type while the TasksTask maps to the content type of the task list. When I used the class for the content type mapped to the list I was querying against, the error went away.

Tuesday, July 6, 2010

SharePoint 2010 Free Development Hands On Labs


Now that you have a development environment you may need to spin up on SharePoint 2010 development. I personally learn best by doing hands on labs and tweaking them and extending them; this is the best way to really learn.

Whether you are experienced or not with SharePoint development here is the best way to learn. I liked this because as an experience SharePoint developer, these hands on labs I found really showed me many of the new features I had been hearing about.

If you need a local SharePoint 2010 development environment, please my detailed blog on how to build one.

Part 1 - SharePoint 2010: Professional Developer Evaluation Guide and Walkthroughs

First I would read this entire document if you want to learn about the new development features of SharePoint 2010.

This has a couple awesome labs to get started on:

  • Lab 1 - shows how to deploy a web part using the new SharePoint 2010 project template and using the new LINQ to SharePoint API.
  • Lab 2 – Deploying WSP solutions in a sandbox.
  • Lab 3 – Show some advanced stuff on how to create custom workflow activity events in SharePoint Designer 2010 and then pull it into a Visual Studio 2010 project. Awesome example of creating a workflow outside the context of a list item which has been a huge limitation for SharePoint 2007.
  • Lab 4 – Shows the new Javascript API for SharePoint.
  • Lab 5 – Shows the new BCS feature and how to build up an external content type in Visual Studio 2010.
  • Lab 6 – Shows you how create a Silverlight project and reference that Silverlight application in a web part.

Part 2 – SharePoint Getting Started Hands On Labs

There are videos and you have the ability to do the labs virtually online.

You can also just download all of the hands on labs and build them on your in your development environment.

  • Lab 1 - Build a simple web part.
  • Lab 2 - Intro into all of the new development features.
  • Lab 3 – Third part of building up web parts.
  • Lab 4 – Server side APIs
  • Lab 5 – SharePoint 2010 client side APIs – a must.
  • Lab 6 – BCS integration.
  • Lab 7 – SharePoint 2010 workflows.
  • Lab 8 – Silverlight integration.
  • Lab 9 – Sandboxed solutions.
  • Lab 10 – Working with the new dialog and ribbon controls for SharePoint 2010.


If you can complete this – I think you will be well on your way to support any SharePoint 2010 development task thrown at you.

How to Create a Local SharePoint 2010 Development Environment


On challenge a lot of people have when wanting to learn SharePoint 2010 is having an environment to do it. Up this point, I have been reliant on getting access to SharePoint 2010 that would run in a hosted environment. The biggest hindrance for running SharePoint 2010 is the dependency of running on 64 bit and having sufficient memory (4GB for development; 8GB for production).

The following are the steps I went through to create a SharePoint 2010 environment that is running locally on my laptop.

Once you have the environment created, read this to do get free development hands on labs.

Host Environment

This is the configuration I have for my laptop.

  • Host OS - Currently on my laptop I am running Windows 7 64 bit. I had thought about using Windows Server 2008 on my laptop but decided against in for the long-term.

  • Memory - I was finally able to upgrade my laptop memory from 4GB to 8GB. That was needed so I could provide the minimum of 4GB.

Guest OS

Now I am lucky that I have a MSDN subscription so obtaining all this was very easy <g>

The following is the configuration you will need to do prior to installing SharePoint.

  • Hardware/Software Requirements – I first reviewed Hardware and software requirements (SharePoint Server 2010).

  • OS – I created a virtual environment and installed Windows Server 2008 R2 on it.

  • Configure OS Server 2008 R2 – I made sure I got the latest updates.

  • Server Roles – Next I added the Web IIS and Application Server roles.

  • Desktop Feature - You will need to turn on the Desktop Experience Feature so Office can save to SharePoint.

  • Static IP Address – Next you will need to apply a static IP address to the VM for the next step to create a Domain Controller. Otherwise you will get an error saying "This computer has dynamically assigned IP address(es)" when installing the domain controller (

  • Create a Domain Controller – Next you will need to add a Domain Controller. I thought I could get away without having a Domain Controller however you will it later when configuring SharePoint 2010. This is because the service accounts need to belong to a domain. Read these simple instructions to set up a Domain Controller (Setting Up Your First Domain Controller With Windows Server 2008). I called my domain SharePoint.local.

  • SMTP Service – You will need this for incoming and outgoing email on your development environment. You will need to incorporate this into the solutions you build. To install and configure the SMTP Service use the guidance here - Configure incoming e-mail (SharePoint Server 2010).

  • SQL Server 2008 R2 – Next I installed SQL Server 2008 R2. Note make sure SSRS was installed and I configured it to run in SharePoint Integrated Mode right off the bat.

  • SSRS Configuration – This was not well documented as part of the installation process for SharePoint. I found this - How to: Configure SharePoint Integration on a Stand-alone Server – specifically focus on the making sure you have the stuff done that you need to do before installing SharePoint 2010. If you are not familiar with Reporting Services configuration you should also check this out - How to: Configure a URL (Reporting Services Configuration). I would recommend creating a new web site in IIS on port 8080 and configure reporting services to run from there. When later configure SharePoint 2010 it will take port 80 on IIS.

  • SharePoint 2010 Prerequisites – Read Hardware and software requirements (SharePoint Server 2010) which has a list of perquisites you need to install. Several of these will be installed for you when you run the SharePoint 2010 Prerequisites tool. What I did was install several of prerequisites myself. What I am going to try next time is see if I can skip this step and let the SharePoint 2010 Prerequisites tool do it all for me.

Install SharePoint 2010 Bits

  • Run SharePoint 2010 Prerequisites Tool – Next I ran the SharePoint 2010 prerequisites tool using the following instructions as guidance - Deploy a single server with SQL Server (SharePoint Server 2010). I ended up getting an error first time saying "The tool was unable to install SQL 2008 R2 Reporting Services SharePoint 2010 Add-in". I just reran the Prerequisites Tool again and the error took care of itself.

  • Create Account Server Farm Account – You will need this during the install. You do not need to give it any permissions; the installation wizard will grant needed permissions. Read the additional references below about all the service accounts that you made need.

  • Install SharePoint 2010 – Next I installed SharePoint 2010 bits using the following instructions as guidance - Deploy a single server with SQL Server (SharePoint Server 2010). It is very similar to SharePoint 2007.

Additional References:

Additional Software

The following is additional software that you will need for your new SharePoint 2010 Development environment!!!!

  • Visual Studio 2010

  • SharePoint Designer 2010

  • SharePoint Workspace 2010

SharePoint 2010 Configuration Wizard

Now comes the fun part of configuring SharePoint 2010, which was significantly quicker than SharePoint 2007.

  • Create SharePoint 2010 Service Account – I will need a service account when going through the SharePoint 2010 Configuration Wizard. I just created a new account on my domain with and gave it no permissions and the Configuration Wizard would take care of that for me.

  • Run SharePoint 2010 Configuration Wizard - Next I needed to run the SharePoint 2010 Configuration Wizard. I followed the guidance in - Deploy a single server with SQL Server (SharePoint Server 2010). I used the new service account and since I had an Enterprise license, I went ahead and installed all the application services so I can play with them. One of the steps in this is to also run the Farm Configuration Wizard in Central Admin. I pretty much turned on all the services that I could.

Now you have completed this, you can open Central Admin. One thing you will notice right off the bat is there is a new status bar that is red sitting right in the middle of the screen with issues or errors. I had a couple but none really worth noting because they are not issues because this is a development environment. For instance I am not going to get all wrapped around the axel on making sure service accounts are not shared across services in my local development environment…

Configure SharePoint 2010 Wizard (Highly Recommended)

Once you have run the configuration wizard, even though you have used the new Farm Configuration Wizard in Central Admin to initialize a ton of services, there are still some steps you need to do. The following are highly recommended configurations you should do for your development environment.

Configure SharePoint 2010 Wizard (Optional)

Much of the configuration below is optional because the Farm Configuration Wizard took care of most of it. You may have to mess with these configurations when you are developing a solution so here are some references you should skim over to get familiar with things.

Additional Resources:

Thursday, July 1, 2010

SharePoint 2010 Physical Topology


In this blog I am going to build off what we has been discussed thus far in this series. Whenever I start working with a new SharePoint client, the first thing that comes up is what is needed to install to get going. Well that answer is always based on business requirements however I am rather quickly forced into a corner to show them how it works J

To be able to define the physical topology you need to know:

  • SharePoint service architecture
  • SharePoint logical architecture
  • Having a strong understanding of availability, capacity, and continuity

Once you have a good idea of that, you will be in a good position to draw out sketches of the Physical Topology for SharePoint you need. For SharePoint 2010, things have changed a lot and the logical architecture is significantly more flexible and scalable. I would say the game has changed in lots of regards.

In this blog I am going to focus on understanding some of the decision logic I would go through when architecting a new SharePoint 2010 farm.

Getting Started

I am going to keep this simple as possible. The first place to get started is to understand your business requirements so you can come up with a list of services that you need. You can read my previous post on SharePoint service architecture.

Next once you have understanding of what services are needed, you will need to come up with a logical architecture for SharePoint. In this series I went over a lot of the design decisions for coming up with that logical architecture for SharePoint.

Here is a refresh on some of those logical architectures. You may come up with a diagram as simple as this one below which is for a Single Farm Single Service Group where services are shared across farms.


You may come up with something like below which is a Single Farm with Multiple Service Groups. The service groups provide dedicated services to site collections.


You may come up with something more complicated which is a Multi Farm environment with centrally hosted services and localized dedicated services.


You come up with a Multi-farm with application services that are partitioned so services are centralized but data is not shared.


Or you may come up with a hosted partitioned farm where farm subscribe to centralized services.


To get more details I recommend you read the Logical Architecture posting of this series.

Selection of a logical architecture should driven by business requirements. The logical architectures I presented above are by no means the only ones; you can come up with tons of different permutations. What I did want to demonstrate is that I made no assumptions yet on how many machines would be needed to support the logical architectures. I will say in a perfect world this would always be true however sometimes the physical architecture affects the logical architecture.

Physical Topology

When we start talking physical topology we need to identify how we are going to configure the environment. There are three types of machines you will have in your farm:

  1. Web tier
  2. Application tier
  3. Database tier

There were a couple things I left out where going over the logical architecture:

  • I did not discuss web or database tiers. I focused only on understanding the application services.
  • I did not discuss how many services would be configured one a single application server or across multiple application servers. Understanding how many servers are needed will be driven by capacity and availability planning which I have also discussed in this series. So it is really important to understand the demographics of the users, their profile, their expectations and how they plan to use SharePoint for both the short and long term.
  • The service groups that I defined in the logical architecture do not drive what services will be configured onto what machines. What we need to focus on is identifying services that have common performance characteristics and configure them onto dedicated server resources (physical or virtual).

There is some basic guidance that Microsoft provides that will help you get started which I am going to go over.

Limited Deployments

This is described as either:

  • One-server farm with all the tiers installed on one server.
  • Two-server where the web and application tiers are installed one server and the database would be installed on an existing SQL Machine.


The one-server farm is described as an Evaluation environment for under 100 users while the two-server farm would support up to 10,000 users. Personally I would never see either of these configurations used except demonstration, proof of concept or development environments. I would not recommend using this for production environments.

Small Farm Topology Deployments

This farm would be scaled out a little more to support more users or provide dedicated servers for services. Web servers, search service and other application services will be distributed across multiple machines. Some potential configurations are:

  • Three-server configuration where there are two web servers that are load balanced. We web server will have the query server configured (which searches an index) and one will be dedicated for all other application services. The third machine is the SQL machine.
  • Four-server configuration where there are two load balanced web servers with the query service running on each. The third server is dedicated to hosting application services and the fourth is used for SQL Server.
  • Five-server configuration is similar to the four-server farm but we separate the index service onto a separate application server.
  • Six-server configuration which is the same as the five-server farm except we create dedicated SQL database for search service to better support crawling.


Microsoft states that two WFEs can support 10,000 to 20,000 users. As well this configuration can support searching up to 10M documents.

The five and six-server farm configurations are very common configurations out there today. It is highly recommended starting place for a company division or for a dedicated solution farm because:

  • There is redundancy for the WFEs – if one goes down users can still access the site.
  • There is performance improvement for users because there are two load balanced WFEs.
  • The application services are dedicated to a machine.
  • Search indexing which can be an expensive operation is dedicated onto a separate application server.
  • Separating the search query and index services provide both performance improves in search and redundancy (i.e. users can still search of the search server is down).

The three and four-server farms I really do not see as viable configurations. At minimum you need to consider a five or six-server farm for production environments.

Medium/Large Farm Topology Deployments

There is no definition which says exactly that X amount servers means you have a medium or large farm. Really I always start with a five farm configuration and from there I will start scaling out servers based on capacity requirements and the logical architecture that I created earlier.


Some observations:

  • Adding more web servers will support more users. A rule of thumb is every web server will support an additional 10,000 users.
  • Based on capacity and availability requirements, add more application servers and spread your services across those servers. These servers can be dedicated to supporting specific service applications. The logical architecture you created will not have a one-to-one mapping of services to server. In some cases, you may have to create multiple servers to support a single service from the logical architecture. Review the blog in this series on capacity planning for more information.
  • There is a potential that you may want to scale content databases onto their own dedicated database server. You may have to consider adding more databases to better support search.
  • You may consider creating dedicated WFEs for search, so when content is crawled, the WFEs that users use is not affected.
  • Scaling out search is very important. SharePoint Search is more scalable and if you are considering using FAST, even more servers will have to be considered. I am not going to dive deeply into scaling search in this blog.
  • It is highly recommended to plan out server groups and with service applications that have similar requirements. You can consider centrally hosting these servers and making them available to other farms.

Extranet/Internet Farm Topology Deployments

Extranets and Internets will require you to have an understanding of how you are going to secure SharePoint with a DMZ. This model by Microsoft is the best place to start. The diagrams for SharePoint 2010 are identical to the ones for SharePoint 2007. I usually recommend implementing the Split Back-to-Back server configuration. Even though the configuration may be more complex, all of the application and database servers will reside behind the firewall and only the WFEs will be placed onto the DMZ.


Hopefully this will help you get started with architecting your SharePoint 2010 environments.