Click here to Skip to main content
16,016,759 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I developed web application that contains code with wcf, linq to sql. In Wcf service class code looks like:
XML
public List<FirstGuardian> Vijay()
{
    List<FirstGuardian> list = new List<FirstGuardian>();
    DBDataContext db = new DBDataContext();
    var v = from i in db.fg0au000s select new { i.Username, i.Password };
    foreach (var i in v)
    {
        list.Add(new FirstGuardian
        {  UserName = i.Username,
            Pwd = i.Password
        });
    }
    return list;
}


Here FirstGuardian is a class that Contains Properties UserName,Pwd. And DBDataContext is a linq to sql class that contains database table fg0au000s.

now i added a wcf service reference and i wrote a code in my default.aspx.cs like:

C#
try
        {
            ServiceReference1.WcfServiceClient obj = new ServiceReference1.WcfServiceClient();
            GridView1.DataSource = obj.Vijay();
            GridView1.DataBind();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }


Now i executed application i am getting error Like below:

There was no endpoint listening at http://localhost:1047/vijaywcf/WcfService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.

Note:Both Wcf Service Code and Client Accessing Code available in same application

Thanks,
Vijay
Posted

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