I create new website in visual studio 2010 :: create asp.net web service, and coding this code in Service.asmx
After that I would like to deploy this web service to sharepoint for use in next step (infopath)
I click public web site, result public fail, I don't know how to deploy/public to sharepoint
Please suggest me !!
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data;
using System.Data.SqlClient;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public Service () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public void AddUser(string Name, string Dates)
{
using (SqlConnection conn = new SqlConnection("Server=192.168.1.4;Database=HR;Trusted_Connection=True;"))
{
// Open a connection to the MySQL database.
conn.Open();
// Add the user.
using (SqlCommand cmd = new SqlCommand())
{
// Initialize the command object.
cmd.Connection = conn;
cmd.CommandText =
"INSERT INTO Holidays " +
"(HolidaysName, HolidaysDate) VALUES (@0, @1)";
// Set the parameters for the command object.
SqlParameter param = new SqlParameter("0", Name);
cmd.Parameters.Add(param);
param = new SqlParameter("1", Dates);
cmd.Parameters.Add(param);
// Add the record to the database.
cmd.ExecuteNonQuery();
}
// Close the connection.
conn.Close();
}
return;
}
}