How to deploy the Custom web service in SharePoint Server in _vti_bin Folder:
Step:1 (Create the web service Project in Visual studio.

Step:2 (Write the web Method in Service .cs File)
Service.cs File
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data;
using System.Data.SqlClient;
namespace
{
[WebService(Namespace = "http://Sample.com/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class ShareService : System.Web.Services.WebService
{
public ShareService () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld() {
return "Hello World";
}
[WebMethod ]
public string PMS(string strmgr,string objective)
{
try
{
string Email = strmgr +"@Sample.com";
SqlConnection con = new SqlConnection ("Server=INMAA-KBSQL; Database=CSS; User Id=pms; password=pms123;");
con.Open();
SqlCommand cmd_get = new SqlCommand("PMSSubmitTest", con);
cmd_get.CommandType = CommandType.StoredProcedure;
cmd_get.Parameters.Add("@Email", SqlDbType.VarChar).Value = Email;
cmd_get.Parameters.Add("@Objective", SqlDbType.VarChar).Value = objective .ToString ();
int ex_Count = cmd_get.ExecuteNonQuery();
if(ex_Count ==1)
{
return ("Success");
}
else
{ return ("failure");
}
}
catch (Exception ex)
{
return ("ex");
}
}
[WebMethod]
public DataSet PMSReceive(string OracleNo)
{
//string Email = strmgr + "@Sample.com";
SqlConnection con = new SqlConnection("Server=INMAA-KBSQL; Database=CSS; User Id=pms; password=pms123;");
con.Open();
SqlCommand cmd_get = new SqlCommand("PMSRegTest", con);
cmd_get.CommandType = CommandType.StoredProcedure;
cmd_get.Parameters.Add("@Email", SqlDbType.VarChar).Value = OracleNo;
int ex_Count = cmd_get.ExecuteNonQuery();
SqlDataAdapter dar_PMSList = new SqlDataAdapter(cmd_get);
DataSet ds_PMSList = new DataSet();
dar_PMSList.Fill(ds_PMSList);
return (ds_PMSList);
}
}
}
Step3:(Assign the web service Project to Strong Name in the web service )
Right Click the web service project and Click the Property pages Tab

Step4: Build the website and it will create the assembly .
Step:5 we can to add that assembly as Reference in that webservice project instead of service.cs file.
Step6:
Normally by Default the web service project will point to the service.cs in ASMX File. We have to place that point to the APP_Copde.DLL
Code for ASMX:
<%@ WebService Language="C#" Class="Sample.ShareService,App_Code" %>
Step7:
Now the ASMX File pointing to the APP_Code DLL.
Imp: Please the Exclude the Service.cs file in that project.
Step8:
Now run this web Service
Output:
http://localhost:1851/ShareServive/ShareSerive.asmx
Step9:
Generating and Modifying Static Discovery and WSDL Files
. Use Disco.exe to generate .disco and .wsdl files. This command line utility is located in the following directory:
C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin
Open command prompt and type the following line and press Enter:
Disco http://localhost:1851/ShareServive/ShareSerive.asmx
Step10:
Now we will get the two files (Disco and WSDL) in the C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin Folder.
Step11:
Rename the Two files as <Service name>disco.aspx and <Service name>wsdl.aspx
Step12:
First we have to replace the Disco file
Replace the Entire Disco file with this code:
<%@ Page Language="C#" Inherits="System.Web.UI.Page" %> <%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint.Utilities" %> <%@ Import Namespace="Microsoft.SharePoint" %>
<% Response.ContentType = "text/xml"; %>
· Important: Replace the Red Mark altered with your Servicename
Step13:
Replace the WSDL file :
<%@ Page Language="C#" Inherits="System.Web.UI.Page" %><%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Import Namespace="Microsoft.SharePoint.Utilities" %><%@ Import Namespace="Microsoft.SharePoint" %>
<% Response.ContentType = "text/xml"; %>
Step14:
Now the Three Files are Ready to use in SharePoint server:
1) Service.asmx
2) Servicedisco.aspx
3) Servicewsdl.aspx
Step15:
Deployment in Sharepoint Server:
1) Copy the (Service.asmx and Servicedisco.aspx and Servicewsdl.aspx ) file to 12\ISAPI Folder.
2) Copy the App_code.dll in the BIN Folder.