Search code examples
javascriptangularjsvisual-studio-2015windows-10iis-10

404 Not Found When Debugging, but URL Works in Browser


I just moved from a Win 7 laptop to Win 10. When debugging the web app on Win 10, I get a 404 Not Found error. However, if I paste the URL into a browser, it works. Is there something funky about Win 10 or IIS 10 that needs to change to allow this to work? This worked just fine when debugging in VS on Win 7.

This is the JavaScript:

var config = {
    url: rootWebApiUrl + '/api/admin/getAdUserName',
    method: 'GET'
};

$http(config)
    .then(function (response) {
        $scope.userName = response.data;
    }, function (response) {
        console.log('err: ', response);
});

And here is the error:

enter image description here

And the URL being used:

enter image description here

If I paste that URL into IE, it works and I get the data. What am I missing?


Solution

  • Put 127.0.0.1 instead rootWebApiUrl. I believe the server doesn't know the address when is debugging, by request lookback address. Windows 10 and the new servers are more prepared to use IPv6, and only localhost affect this. Now, why this difference between normal mode to debug mode, it's not really assertive for me.