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

1.1k views Asked by At

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...

2

There are 2 answers

3
Cameron On BEST ANSWER

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.

3
EvgK On

You can host a web service in a _layouts folder for example. Just create some folder there (like "MyService"), put your .asmx, then put your web service .dll in GAC (don't use code behind). Restart IIS and you service would be available at http:///_layouts/MyService/.asmx.