I want to use WCF service in SharePoint 2010 but have problem.
First, in mapped Sp2010 folder(ISAPI) I created newfolder/myfile.svc and in that file I put a reference to my DLL:
<%@ServiceHost
Language="C#" Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressBasicHttpBindingServiceHostFactory,Microsoft.SharePoint.Client.ServerRuntime, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"
Service="ACIS.WCFService.GraphProccesor, ACIS.WCFService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c4ecbdc9be141501"
%>
Then, in an additional folder (outside ISAPI) I created WCF service logic (class GraphProccesor, namespace ACIS.WCFService)
I compiled, deployed and everything seems ok. in my .dll (c4ecbdc9be141501) - I have namespace and class (same as in above directive), in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI\ACISWCFService - I have myfile.svc
But when i try to get url of service in IE i got:
The type 'ACIS.WCFService.GraphProccesor, ACIS.WCFService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c4ecbdc9be141501', provided as the Service attribute value in the ServiceHost directive could not be found.
Please, any suggestions? Did I forget something additional?
Edit #1: Ok, thank you for suggestion but that didn't help. What partially helped is that I added web.config (in first place i forgot that) in _vti_bin/myfolder. Now I getting error message: "Cannot create a file when that file already exists. (Exception from HRESULT: 0x800700B7)"
When I try to get my svc file with "svcutil.exe" in the way "http://dt-slavenl/sites/acis/_vti_bin/ACISWCFService/service.svc" i got message:
WS-Metadata Exchange Error URI: http://dt-slavenl/sites/acis/a1/_vti_bin/ACISWCFService/service.svc Metadata contains a reference that cannot be resolved: 'http://dt-slavenl/si tes/acis/a1/_vti_bin/ACISWCFService/service.svc'. The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'. The remote server returned an error: (401) Unauthorized. HTTP GET Error URI: http://dt-slavenl/sites/acis/a1/_vti_bin/ACISWCFService/service.svc The HTML document does not contain Web service discovery information.
Edit #2: I manage to come "near" my webservice thanks to Marek link. New problem is that when I want to access to web service from IE i got:
Security settings for this service require 'Anonymous' Authentication but it is not enabled for the IIS application that hosts this service.
If somebody know how to configure SP app pool or web.config so that I can access from IE, that would be awesome! If not, my new strategy is to create web part (full trust) with image control which has property "imageurl" set to http handler (.ashx) WHICH then will communicate with my wcf service and give response (image) to image.imageurl. If somebody see some potential problems please let me know. Also any suggestion for best way how to implement proxy or client access (from .ashx) will be appreciated!
AspNetCompatibilityRequirements
andBasicHttpBindingServiceMetadataExchangeEndpoint
attributes to your class? answers.oreilly.com/… The documentation on this is rather poor, but I think that without the 2nd one the/mex
address will not work.Anonymous
authentication? Why notNtlm
? You log in to SharePoint (using integrated authentication, I suppose) and then the same credentials will be automatically passed to the service. BTW, you question is getting too big - consider posting other problems as new questions.