Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I did a web service :

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Data;

namespace MemberWebService
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // 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 Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public DataSet GetMemberData(string memberId, string thirdName)
        {
            SqlConnection cn = new SqlConnection("Data Source=.;Initial Catalog=Healthy;Integrated Security=TRUE");
            SqlDataAdapter da = new SqlDataAdapter();
            DataSet ds = new DataSet();

            da.SelectCommand = new SqlCommand("SELECT * FROM MemberMaster WHERE MemberId=@MemberId and ThirdName=@ThirdName", cn);
            da.SelectCommand.Parameters.Add("@MemberId", SqlDbType.NVarChar).Value = memberId;
            da.SelectCommand.Parameters.Add("@ThirdName", SqlDbType.NVarChar).Value = thirdName;

            ds.Clear();
            da.Fill(ds);
            return ds;
        }
    }
}


when i run it, it is working on my localhost i want to run it on another server like this link : http://62.215.220.133/SHAMiphone/sip.asmx

How can i do that ?
Posted

1 solution

For hosting the Webservice (similar to web application):

1. In IIS7: Deploying ASP.NET Websites on IIS 7.0 [^]
2. In IIS6: Deployment of a Website on IIS[^]

How to use the hosted webservice: How to make a simple WebService and consume it.[^]
 
Share this answer
 
Comments
tranesyasd 27-Mar-13 3:49am    
I made these steps but still my web service run on the localhost how can i host it to run the web service from another machine.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900