سؤال

I developed a Desktop app using C# and winforms in VS 2012 target .NET 4.0. I'm using RestSharp for API Communication, The following code works fine.

private RestClient client = new RestClient(Constants.BASE_URL);
var request = new RestRequest("venue/login", Method.POST);
                request.AddParameter("email", email);
                request.AddParameter("password", password);
                IRestResponse<LoginResponse> response = client.Execute<LoginResponse>(request);
                if (response.StatusCode.Equals(HttpStatusCode.OK))

I'm trying to implement the same app in VS 2010 with C#, WPF and target .NET 4.0. But using the same above code IRestResponse<LoginResponse> response = client.Execute<LoginResponse>(request); does not return any result. it just hangs. I'm using RestSharp version 104.4.0.0 for both projects. What could be the problem?

Edit : nginx config

server{
        listen 80;
        server_name api.xyz.com;
        access_log /var/log/nginx/node.access.log;
        location / {
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $http_host;
                proxy_set_header X-NginX-Proxy true;
                proxy_pass http://node;
                proxy_redirect off;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
        }
}

Note: If i give the BASEURL localhost/api (Dev version) it works. Its not working in production (api.xyz.com).

هل كانت مفيدة؟

المحلول

I think its a firewall issue. Worked when i disable the antivirus firewall.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top