我有一个调用 wcf 服务方法的 wpf 应用程序。该方法在调试模式下运行良好,但该方法不会返回到客户端调用。
Here is the code.
Client:
public class Provider
{
private static ActionServiceClient Client { get; set; }
static Provider()
{
Client = new ActionServiceClient();
}
public UserResponse GetUsers(UserRequest request)
{
UserResponse resp = new UserResponse();
resp = Client.GetUsers(request);
return resp;
}
}
WCF Service :
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Reentrant, UseSynchronizationContext = false)]
public class ActionService : IActionService
{
public MovieResponse GetReviews(MovieRequest request)
{
List<MovieReview> reviews = DataAccess.GetMovieReviews(0);
MovieResponse response = new MovieResponse();
response.movieReviews = reviews;
return response;
}
public UserResponse GetUsers(UserRequest request)
{
List<User> users = DataAccess.GetUsers(0);
UserResponse resp = new UserResponse();
resp.users = users;
return resp;
}
[DataContract]
public class UserResponse
{
[DataMember]
public List<User> users;
}
[DataContract]
public class UserRequest
{
[DataMember]
public int userId;
}
我在调试模式下运行程序,并在服务调用完成后 wpf 应用程序挂起......