I create web service in VS2010 ,, How to deploy Webservice in Sharepoint 2010 ? - InfoPath Dev
in

InfoPath Dev

I create web service in VS2010 ,, How to deploy Webservice in Sharepoint 2010 ?

Last post 01-16-2011 11:52 PM by MinkZzZzZzz. 0 replies.
Page 1 of 1 (1 items)
Sort Posts: Previous Next
  • 01-16-2011 11:52 PM

    I create web service in VS2010 ,, How to deploy Webservice in Sharepoint 2010 ?

     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;
    }
    }

     

Page 1 of 1 (1 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.