AngularJS and Web API :- net::ERR_CONNECTION_REFUSED in chrome and error 00002efd in IE

There are lots of question like my question but I didn't any working solution.

I am using AngularJS and WebApi2 in my application.

Here is the JS code which call the initial API.

(function (module) {
var baseUrl= "http://localhost:85";
module.constant('Config', baseUrl);
module.service('identities', ['$http', function ($http) {
    var uri = baseUrl+ '/api/controller/GetRole';

    var identities = {};
    identities.get = function () {
        var temp = $http.get(uri);
        console.log(temp, "identities");
        return temp;
    }
    return identities;
}]); 

This function call the GetRole method in web API controller to retrieve user role.The output of this method is JSON with user details.

I have deployed the application on a server to port 85. When I run the application it's throwing error in Chrome:

net::ERR_CONNECTION_REFUSED

and in IE 11:

XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd

There is no log created in IIS for this request.

Using fiddler I got this in Raw with status code 502 in response. The connection to 'localhost' failed.

Error: ConnectionRefused (0x274d).

System.Net.Sockets.SocketException No connection could be made because the target machine actively refused it 127.0.0.1:85.

I have also tried by disabling the CORS in chrome but no luck. IF I use IP address of server instead of localhost as baseUrl in angular JS code then it's working fine. Why it's not working with localhost?

I am doing a GET call and Error for me is 00002efd not 00002ef3.

Answers:

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.