WPF应用程序调用WCF服务方法,然后wpf应用程序挂起

时间:2012-11-05 16:54:34

标签: wcf

我有一个调用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应用程序挂起....

1 个答案:

答案 0 :(得分:0)

哎呀....不允许传递图像。