views:

98

answers:

2

Hi all,

I have deployed a WCF service to SharePoint and on my own machine everything works fine. Navigating to the .svc works and, as expected, navigating to service.svc/Operation generates a "method not allowed message". Posting to the service using jQuery also works perfectly on my own machine.

However, when my colleague gets the latest version from source control and deploys the feature, he can navigate to the .svc allright, but navigating to service.svc/Operation generates a 404, and off course posting wiht jQuery doesn't work either.

I am thinking this has to do with something I did configure on my machine (and forgot afterwards :-S) and my colleague did not configure yet. We did run ServiceModelReg -i on his machine.

The .svc file looks like this:

<%@ ServiceHost Language="C#" Debug="true" Service="NameSpace.ServiceName" Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>

The service's assembly is loaded in the web.config's assemblies section and is loaded (break points are red when debugging).

Edit: Anyone?

A: 

One thing I can think of is you missed the serviceModel section in web.config... is that the case? It's something like

  <configuration>
    <system.serviceModel>
      <services>
        <service behaviorConfiguration="behavior1" name="HelloWorld.service1">
          <endpoint address="" binding="wsHttpBinding" contract="MyServices.IHelloWorld" />
          <host>
            <baseAddresses>
              <add baseAddress="http://server/_wcf/HelloWorld.svc" />
            </baseAddresses>
          </host>
        </service>
      </services>
      <behaviors>
        <serviceBehaviors>
          <behavior name="behavior1">
            <serviceMetadata httpGetEnabled="true" />
            <serviceDebug includeExceptionDetailInFaults="false" />
          </behavior>
        </serviceBehaviors>
      </behaviors>
    </system.serviceModel>
  </configuration>
Ariel
There is a small web.config in the .svc file's folder to enable asnet compatibility, but because I use WebScriptServiceHostFactory the rest is not needed.
Colin
A: 

I managed to fix the problem. We were using Sahil Malik's excellent open source solution, WCFSupport. Somehow the dll was not being loaded (even though the registration was in the web.config for teh HttpModule and the assembly).

After first trying the service itself in a dummy web app project I created in visual studio (added the .svc file, added assembly reference to my service's dll in the web.config and added new site in IIS), I came to the conclusion that it was not the service itself, nor any configuration issue in IIS (i.e. the servicemodelreg.exe tool).

So it had to be the code that mapped requests for a .svc, and more importantly request for any of it's operations was not working. I copied Sahil's code to our own solution, deployed that and then it worked. Why the code works now, no idea, maybe the original WCFSupport dll was corrupt, we'll never know.

Anyway, it works now!

Colin