All you need is an .asmx file and the [WebMethod] attribute to define your
Web service:
Your asmx file can look like this:
<%@ WebService Language="C#" Class="Util" %>
using System;
using System.Web.Services;
public class Util: WebService
{
public int Add(int a, int b)
{
return a + b;
}
[ WebMethod]
public long Multiply(int a, int b)
{
return a * b;
}
}
If you want to store your code inside a .cs file, then bring it out of your
asmx file. Then, compile the .cs file as a dll and put both the asmx file
onto IIS application and the dll inside the bin/ directory of your
application.
> Can anyone provide any pointers or sample code on how to create/code a
> web service without using Visual Studio? I would like to make a
> single-file .cs class library with all the plumbing it needs to be a
> web service - it will be hosted in IIS.
>
> Thanks.