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:
[csharp]
[AspNetCompatibilityRequirements(RequirementsMode=AspNetCompatibilityRequirementsMode.Allowed)]
[/csharp]
As well in the SharePoint web.config, in the serviceHostingEnvironment make sure the aspNetCompatibilityEnabled attribute is set to true.

Share

ExitDesignModeControl

Description The Microsoft.SharePoint.WebControls.ExitDesignModeControl inherits from the System.Web.UI.WebControls.WebControl class. The ExitDesignModeControl is responsible for calling the appropriate JavaScript that will toggle the layout mode of a WebPart page out of Design Mode. The most apparent location where this control is employed is on a WebPart page while in Edit Mode.

This Post Details Content That I Have Written Regarding The SharePoint API On MSDN. The Full Article Will Have These Contents As Annotations Of The Full Article.

I Encourage You To Read The Full MSDN Class Documentation, Since Things Like Type Hierarchy Are Illustrated.

Adam Buenz – WSS MVP – Community Content From Annotations edited by Adam Buenz – MVP:

Description The Microsoft.SharePoint.WebControls.ExitDesignModeControl inherits from the System.Web.UI.WebControls.WebControl class. The ExitDesignModeControl is responsible for calling the appropriate JavaScript that will toggle the layout mode of a WebPart page out of Design Mode. The most apparent location where this control is employed is on a WebPart page while in Edit Mode.

Read All Of This MSDN Community Content: ExitDesignModeControl

Share