Resolving “the local SharePoint server is not available” Error

When doing development with SharePoint, it is pretty well-known that because you develop directly against the object model that the environment must have SharePoint present. However, at a client this morning I was helping to build some test and development environments and for some reason the error:

“the local SharePoint server is not available”

kept bubbling up, when clearly there was a local SharePoint instance present. This error can occur after a variety of actions, such as invoking SharePoint Explorer or in visual studio deployment steps.

The quickest way to resolve the error make sure that the account being used to run Visual Studio is a db_owner on the SharePoint config and SharePoint admin databases.


InvalidOperationException With WCF Service In SharePoint 2010

At a client today we were focusing on moving a bunch of custom, in-house deliverables to a SP 2010 RC environment so that we could test all the moving pieces required for their environment to function. About half way through all successful, uneventful testing, we finally hit an error when examining a WCF service hosted in SharePoint. The particular error message was:

[InvalidOperationException: Operation is not valid due to the current state of the object.] Microsoft.SharePoint.ApplicationRuntime.SPLayoutsMappedFile.MapLayoutsVirtualPath(String virtualPath)

If you run into this error, its pretty easy to fix. In the ServiceBehaviorAttribute of your service class, ensure the following is present:
As well in the SharePoint web.config, in the serviceHostingEnvironment make sure the aspNetCompatibilityEnabled attribute is set to true.