Click here to Skip to main content
15,608,772 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
This is my Code:

WebClient reportClient = new WebClient();
     //String uri = "/ServiceManager.svc/GetReport";
     string uri = "";
     reportClient.DownloadStringCompleted +=new DownloadStringCompletedEventHandler(reportClient_DownloadStringCompleted);
     reportClient.DownloadStringAsync(new Uri(uri));

My web service is now hosted separately

[WebInvoke(Method = "GET",
BodyStyle = WebMessageBodyStyle.Bare, RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json,
UriTemplate = "GetState")]
public List<State> GetState()
    DBManager dbManager = new DBManager(DataProvider.SqlServer);
    dbManager.ConnectionString = ConfigurationManager.ConnectionStrings["LaborInsightConnectionString"].ConnectionString;
    List<State> stateList = new List<State>();
        dbManager.ExecuteReader(CommandType.Text, "select Name , FullName  from CanonState where FullName<>'Unknown'");
        while (dbManager.DataReader.Read())
            var rep = new State
                id = dbManager.DataReader[0].ToString(),
                Name = dbManager.DataReader[1].ToString()

    catch (Exception ex)
        throw ex.InnerException;
        //return null;
    return stateList;

When web service is separately hosted, it is not able to consume in my project.

Please help me. Thanks in advance.
Sandeep Mewara 14-Mar-11 2:19am    
what is the error? What does it say when you try to consume it?

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