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

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

本文介绍了WPF应用程序调用WCF服务方法然后wpf应用程序挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个调用 wcf 服务方法的 wpf 应用程序.该方法在调试模式下运行良好,但该方法不会返回到客户端调用.

I have a wpf application which calls a wcf service method. The method runs fine in debugging mode but the method doesnt return back to the client call.

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 应用程序挂起......

I run the program in debug mode and after completion of the service call the wpf application hangs....

推荐答案

糟糕....不允许传递图像.

Oops....Passing an image is not allowed.

这篇关于WPF应用程序调用WCF服务方法然后wpf应用程序挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 00:34