How to refer SharePoint assemblies in a WCF service application? - wcf

It gives errors when I refer Microsoft.SharePoint.Administration; Microsoft.Office.Server dlls in a WCF service application. It does not identified the added assemblies. How to resolve this issue?

In which .NET Framework Version is your WCF service written? SharePoint 2010 is implemented using .NET FX 3.5, so you can only reference SharePoint Assemblies if your targeting the same FX Version.
Your WCF service also has to run on a SharePoint box, it's not possible to reference a SharePoint related assembly on a non SharePoint machine.
How does your reference looks like? You've to reference the Assemblies from the ISAPI folder within SharePoint Root (which should be Program Files\Common files\Microsoft Shared\Web Server Extensions\14\ISAPI\ by default)

Related

VS 2013 WCF Service Library missing

Quick question
I am doing a Plural Sight tutorial on WCF and they are using the WCF Service Library (as opposed to application.)
When I go to Add new project there is no WCF Service Library. Not under any of the .NET versions.
I am using Visual Studio 2013 for Web Express.
Any one know how I can get it?
Thanks
You can find it under Templates WCF.
( Go to New Project->Installed-->Templates-->WCF)

Installing a WCF service that does not have a MSI

I have developed a WCF service using .NET 3.5, VS 2010 on Win 7 64. This will be hosted in a Windows Service.
I created a Windows Service project to which an Installer is added by rt-clicking. The WCF dll is also added.
For testing purpose I have installed this service by running the InstallUtill.exe passing in the service exe from the Windows Service project release folder. All works fine I can see the service in Services.msc and they can be accessed by clients.
The client does not want an MSI so I have to give him the release folder of the Windows Service project.
Here are my questions:
Is it required to add the .NET framework requirement, which gets added by default for MSI projeccts, to the Windows Service project. If yes then how do I go about doing it?
Can the client use the InstallUtil.exe from the framework or is there another way to install on machines that don't have VS?
Does the service need to be built for both 32 and 64 bit systems?
I know that InstallUtil.exe is part of the framework and any machine that has one is good to go but just out of curiosity is there any other way to install the Windows service without an MSI?
Regards.
I don't know about InstallUtil.exe, but I do know that in order to install a WCF service manually, you need to:
Give the client the requirements (.NET framework, WCF installed)
Create a folder in IIS for the service
Create a bin folder in that folder
Copy the .svc and the web.config in the first folder, and copy the .dll in the bin folder
In IIS, right-click on the folders and Convert to application (the two folders)
Be sure that the folders have the appropriate rights
I had to do this for test purposes on several machines at my job. But in the end, we did an MSI for the client.
Hope that helps you!

Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154

I am running 32 bit Windows 7 Operation System which has IIS 7.5 installed.
In Visual Studio 2010, I open my solution having the web site project hosting WCF service. I have created an application in the IIS which points to the website project. The web site's bin folder has many assemblies which I need to refer. But those assemblies also have built using .NET 4 on the same computer.
I can browse the WCF service using both HTTP & HTTPS.
However, when i access the service from the test windows application (using the proxy class of the WCF contract), I get the error in question. Everything was working without problem earlier.
Anyone can help to fix the issue?. How to investigate this issue?
Error 0x80040154 means "Class Not Registered", which usually means you're depending on a COM component that hasn't been installed properly on the machine.
Is any of those Assemblies you reference a COM Interop Assembly? If so, find out what it uses and then install the appropriate COM component.

wcf service on mobile 5.0

I have writed a primitive wcf (vs 2010) service and created proxy files by svcutil. Later I created a mobile project on vs2008 and added proxy files on project but this error occured.
Error 1 The type or namespace name 'ServiceContractAttribute' does not exist in the namespace 'System.ServiceModel' (are you missing an assembly reference?) C:\Users\Abb\Documents\Visual Studio 2008\Projects\WCF\MobileService\MobileClient\Sample.cs
the proxy files runs well on console application (vs 2008) but there is errors on mobile.
System.ServiceModel doesnot support ServiceContractAttribute.
For mobile applications you shouldn’t use SvcUtil to generate proxies since this does not generate code compatible with the subset of WCF functionality available to the .NET Compact Framework on mobile devices.
Instead, you should use NetCFSvcUtil.exe. See this link for more information: Using NetCFSvcUtil.exe to interact with ServiceContracts

Visual C# 2010 Express - no WCF project template

I can't see any template to start a WCF project (I do see ones for WPF amongst other things). Is this because I don't need a template, or because it's missing in Express, or because I'm looking in the wrong place?
See How to add WCF templates to Visual Studio Express? - although that question relates to VS2008 it may help.
It's a template in the Web Developer version.
"WCF RIA Services Class Library" and "WCF Service Application" are both listed there.
I think I understand why Microsoft are packaging the WCF projects with the Web Developer version but it an arbitrary distinction. I can't see why they don't include them in both applications.