[ServiceContract]
public interface IService1
{
[OperationContract]
IEnumerable
// TODO: Add your service operations here
}
//implementation
public class Service1 : IService1
{
public IEnumerable
{
XDocument xdoc = XDocument.Load(HttpContext.Current.Server.MapPath("Dept.xml"));
IEnumerable
select new Department
{
Name = p.Element("Id").Value,
Dept = p.Element("Dept").Value,
};
return depts;
}
}
//testing wcf in a web application
protected void Page_Load(object sender, EventArgs e)
{
ServiceReference1.Service1Client dd = new ServiceReference1.Service1Client();
GridView1.DataSource = dd.depts();
GridView1.DataBind();
}
this is the error
object reference not to set instance of an object
Replies
Know the answer? Post it — somebody with the same question will find it here.