Search code examples
wcfsharepointsharepoint-2007wss-3.0virtual-path

Create a VirtualPath in IIS for hosting a Web Service in SharePoint


I am trying to host a custom web service in SharePoint 2007 (WSS 3.0) and so far I have followed the instructions here to create a simple 'Hello World' web service: Create WSS Web Service

However, when i get to the virtual path bit in step 4 I am struggling to see in visual studio how I create this and then deploy to make a virtual path to make my web service accessible.

Can anyone help me sort out creating a virtual path for WSS or point me in the direction of another guide to create and host a web service in SharePoint?

Thanks in advance...


Solution

  • You need to register the module in the web.config under configuration/system.web/httpModules.

          <add name="ArbitraryName" type="Namespace.ClassName, AssemblyName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=XXXXXXXXXXXXXXX" />
    

    Then you can put it in any directory you'd like. If you're using WSS 3.0 check to see if the previous virtual path provider has a name of "SPVirtualPathProvider". If you're using MOSS 2007 check to see if it has a name of "CmsVirtualPathProvider".

    Daniel Larson does a decent job of walking you through it in Chapter 11 in his book Developing Service-Oriented AJAX Applications on the Microsoft Platform.

    The best way to do this is normally a FeatureEventReceiver using the SPConfigModification class. This way it pushes out to all the servers in your farm.