If you get the “Type cannot be found” error after installing your WCF service, go to the section about unloading your project below.
Here are the main steps to creating a WCF service and installing it on a SharePoint 2010 server:
- Open Visual Studio 2010
- Create an Empty SharePoint 2010 project to get the packaging files
- Change your namespace in the Project Properties.
- Add a new Item, WCF Service with a new file name
- Add the following lines above the class declaration that implements the “IService” file:
[AspNetCompatibilityRequirementsAttribute(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
{ Add the following sample: <%@ServiceHost http://msdn.microsoft.com/en-us/library/ff521581(v=office.14).aspx Gotcha from MSDN: Make sure to Unload your project and add this to the project file: <TokenReplacementFileExtensions>svc</TokenReplacementFileExtensions> Just above </PropertyGroup> Because Visual Studio 2010 by default does not process the type of tokens used in the previous .svc file, you must add an additional instruction in the project file. Save all changes in your project, right-click the RevertService project, and then click Unload Project. Right-click the RevertService node again, click Edit RevertService.csproj or Edit RevertService.vbproj, and add a <TokenReplacementFileExtensions> tag as follows to the first property group in the .csproj or .vbproj file to enable processing of tokens in .svc file types.
public
class
PricingRequestService : IPricingRequestService
Language=”C#” Debug=”true”
Service=”PricingRequest.PricingRequestService, $SharePoint.Project.AssemblyFullName$”
Factory=”Microsoft.SharePoint.Client.Services.MultipleBaseAddressBasicHttpBindingServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”
%>
Leave A Comment