Exception: le serveur distant a retourné une erreur not found
Bonjour
J'ai besoin d'afficher la liste des etudiants dans une datagrid a l'aide de WCF Services
Voici le code de service :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using DAL;
using POCO;
using System.Collections.Generic;
namespace ESPRIT_FLEET_MANAGER.Web
{
[ServiceContract(Namespace = "")]
[SilverlightFaultBehavior]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1
{
[OperationContract]
public IList<Employees> LoadAll()
{
using (Esprit_FleetEntities db = new Esprit_FleetEntities())
{
var records = from record in db.Employees select record;
return records.ToList();
}
}
// Add more operations here and mark them with [OperationContract]
}
} |
voici le code de ma page main
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| sing System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
namespace ESPRIT_FLEET_MANAGER
{
public partial class Page2 : Page
{
public Page2()
{
InitializeComponent();
load();
}
// Executes when the user navigates to this page.
public void load()
{
ServiceReference1.Service1Client serv = new ServiceReference1.Service1Client();
serv.GetEmployeeByIdCompleted+=new EventHandler<ServiceReference1.GetEmployeeByIdCompletedEventArgs>(serv_GetEmployeeByIdCompleted);
serv.GetEmployeeByIdAsync(2);
}
public void serv_GetEmployeeByIdCompleted(object sender, ServiceReference1.GetEmployeeByIdCompletedEventArgs e)
{
IEnumerable<ServiceReference1.Employees> list = e.Result as IEnumerable<ServiceReference1.Employees>;
dataGrid1.ItemsSource = list;
}
}
} |
Merci de m'aider