Microsoft Edge: SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 00002efd - xmlhttprequest

Running on Windows 10, Microsoft Edge. I have an app installed locally on my machine in IIS (10.119.103.10) which is trying to make requests to another machine on the network (10.119.103.2) which is setup to use CORS.
This all works in chrome and internet explorer ... here is a test case
function LOG(message) {
var el = document.createElement('pre');
el.textContent = message;
output.appendChild(el);
}
function xhrtest(url) {
var XHR = new XMLHttpRequest();
LOG("OPEN " + url);
XHR.open("GET", url, true);
XHR.onreadystatechange = function(e) {
LOG('READY ' + XHR.readyState + ' STATUS ' + XHR.status + ' ' + XHR.statusText + ' TYPE ' + XHR.responseType);
LOG(XHR.response);
}
LOG("SEND");
XHR.send();
}
<button onclick="xhrtest('http://10.119.103.2/~adf/RMC2/trunk/server/?r=get')">XHR TEST</button>
<hr/>
<div id="output"></div>
In Microsoft Edge however, I get the following error
SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete
the operation due to error 00002efd.
The client (XMLHttpRequest) isn't even attempting to connect to the server, it bails immediately. The test case producing this output:-
OPEN http://10.119.103.2/~adf/RMC2/trunk/server/?r=get
SEND
READY 4 STATUS 0 TYPE
I suspect this is something to do with private networks though really I have no idea, nor any idea how to resolve it.

I have the same "SCRIPT7002: XMLHttpRequest: Network Error 0x2efd" problem whenever my webpage would try to connect with other web server via ajax. My page was working fine in all other browsers even in IE 11. I resolve it by turning off the smart screen filter in Edge browser. I think smart screen filter blocks ajax communication with websites which it think suspicious or low reputation.check this link for more info

I'm seeing something similar .... I have a Windows phone App developed using Cordova and the VS2015 tool set. When I use our company WIFI or Mobile Data connection, the AJAX request works fine. But when using non-company wifi e.g at home then I get error "XMLHttpRequest: Network Error 0x2ee2, Could not complete the operation due to error 00002ee2" with response "readyState":0,"status":0,"statusText":"error".
Can you try connecting via a 3G/4G connection and see if that works.

Had the same issue and it turned out that Wifi property Make this PC discoverable was turned off. Turning it on fixed the issue.

Related

How to access with my mobile to an app that use an api that is host in localhost

Im using an api in order to login in my ionic app.
It works as normal but when I use it in my phone it doesn't work.
When I'm trying to do it, an error appears to the console
E/Capacitor/Console: File: http://localhost/vendor.js - Line 70452 - Msg: ERROR [object Object]
This is how I use my api
var url2 = "http://localhost:3625/api/Filters/LoginEmployee";
Im trying to change a line that allows the connection in Manifest but it doesn't work.
When you run the APP inside your phone, the http://localhost/vendor.js should be changed to the IP of the computer where the API is running.
If you are testing probably the server is your machine, put both devices, the phone and the computer in the same network to make both available to ping each other.
Verify if your access point is not blocking the 3625 port in the local network.

Selenium iOS Driver behind Proxy

We are trying to run some automated tests for our Xamarin based iOS app using the Selenium IOSDriver within Visual Studio for Mac.
The error we are getting when we run them is (I've sanitised to remove the URL we are actually trying to send the request to).
A exception with a null response was thrown sending an HTTP request to the remote WebDriver server for URL https://<Test Host URL>. The status of the exception was NameResolutionFailure, and the message was: nodename nor servname provided, or not known nodename nor servname provided, or not known
Because our machines are behind a proxy we often see DNS errors like this when the code sending the request is unaware of the proxy.
We've tried various approached to setting the proxy, such as HttpClient.DefaultProxy and OpenQA.Selenium.Proxy but the error still persists.
Are there any other ways to tell Selenium that it is operating behind a proxy?
For anyone else struggling with this the answer seemed to be using a 'HttpCommandExecutor'
var uri = new Uri("https://hub.browserstack.com/wd/hub/");
var commandExecutor = new HttpCommandExecutor(uri, TimeSpan.FromSeconds(30))
{
Proxy = new WebProxy
{
Address = new Uri("http://your.proxy")
}
};
driver = new IOSDriver<IOSElement>(commandExecutor, options);

connection refused by server error when codenameone project is copied to another machine

I have a very strange problem:
I have created a project in Intellij using the Codename One plugin.
In this project I access a Google Sheet using Oauth2 authentication
following these directions from the Codename One site.
https://www.codenameone.com/google-login.html
My code to do this works fine on my computer (Windows 10).
If I copy that code to another computer (Windows 10 or OS X) and try to access the Google Sheet, I get a "Connection refused by server" error.
Specifically, I get the error after I click on the "Allow" button in
the Google Login dialog box.
I have tried this on several computers.
I receive the error no matter what network/ISP I am using when I try to access the Google Sheet.
The stack trace relating to the error looks like this:
java.lang.Throwable: Connection refused by server
at javafx.scene.web.WebEngine$LoadWorker.describeError(WebEngine.java:1461)
at javafx.scene.web.WebEngine$LoadWorker.dispatchLoadEvent(WebEngine.java:1400)
at javafx.scene.web.WebEngine$LoadWorker.access$1200(WebEngine.java:1278)
at javafx.scene.web.WebEngine$PageLoadListener.dispatchLoadEvent(WebEngine.java:1265)
at com.sun.webkit.WebPage.fireLoadEvent(WebPage.java:2443)
at com.sun.webkit.WebPage.fwkFireLoadEvent(WebPage.java:2287)
at com.sun.webkit.network.URLLoader.twkDidFail(Native Method)
at com.sun.webkit.network.URLLoader.notifyDidFail(URLLoader.java:883)
at com.sun.webkit.network.URLLoader.lambda$didFail$102(URLLoader.java:866)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
Process finished with exit code 0
The code that is being executed when the error is generated is:
public void oauth2GoogleLogin()
{
String clientId = "xxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com";
String redirectURI = "http://localhost:8080";
String clientSecret = "xxxxxxxxxxxxxxxxxxxxxxxx";
Login gc = GoogleConnect.getInstance();
gc.setClientId(clientId);
gc.setRedirectURI(redirectURI);
gc.setClientSecret(clientSecret);
gc.setScope("https://www.googleapis.com/auth/spreadsheets");
gc.setCallback(new LoginCallback() {
#Override
public void loginFailed(String errorMessage) {
super.loginFailed(errorMessage);
}
#Override
public void loginSuccessful() {
super.loginSuccessful();
System.out.println("Logged in.");
token = gc.getAccessToken().getToken();
//saveData();
}
});
if(!gc.isUserLoggedIn()){
gc.doLogin();
}else{
....some code to do stuff...
}
}
As I have said, this code works fine on the computer where I wrote it, but if I transfer the Intellij/Codename One project to another computer, it no longer works.
It seems to me that the problem is probably in the callback, and that the server that is refusing the connection is probably my own computer being accessed via the http://localhost:8080. But I'm not sure. Can anyone enlighten me?
If both machines no longer work that makes more sense that a regression in newer versions of JavaFX's web browser broke the Google OAuth2 process.
Unfortunately, that's a huge problem. We can't fix JavaFX and if they push out a broken update we are stuck.
A workaround might be to try an older version of the VM e.g. 1.8.67 or something.

WebRTC setup and related queries

I am trying to setup a peer to peer connection for WebRTC application. I have read the forums and discussion groups which lead me to the point that STUN/TURN servers are required for the same. Here are the details:
I downloaded the open source implementation of the STUN/TURN server from https://code.google.com/p/rfc5766-turn-server/
Installed the server on my local Mac OS X machine and turned on the server on localhost:3478
When I tested the server using the client scripts, I was able to get back the remote address from the server.
However, when I try to hit the server from my JavaScript code while creating a peer to peer connection, it is not hitting the server itself.
Below is the code which I am using :
function createPeerConnection() {
var pc_config = {'iceServers': [{'url':'turn:127.0.0.1:3478', 'credential':'Apple123'}]};
try {
// Create an RTCPeerConnection via the polyfill (adapter.js).
pc = new webkitRTCPeerConnection(pc_config);
pc.onicecandidate = gotLocalCandidate;
trace("Created RTCPeerConnnection with config:\n" + " \"" +JSON.stringify(pc_config) + "\".");
} catch (e) {
trace("Failed to create PeerConnection, exception: " + e.message);
alert("Cannot create RTCPeerConnection object; WebRTC is not supported by this browser.");
return;
}
pc.onconnecting = onSessionConnecting;
pc.onopen = onSessionOpened;
pc.onaddstream = onRemoteStreamAdded;
pc.onremovestream = onRemoteStreamRemoved;
}
Appreciate any guidance in this matter as I am completely stuck at this point.
One more question: How to setup a peer to peer connection for WebRTC application where both peer A and B are present on an internal network? Is STUN/TURN servers required then?
First, TURN servers are something that are used only if failing to setup an p2p connection directly. About 86% of all calls can be made without relaying via a TURN server (according to this slide, which I by the way recomend to get a better understanding of TURN (from slide 44)).
TURN server should be outside your network since the purpose of it is to relay the stream when not possible to do so in other way.
I would recomend you to start with the case where both A and B are on the same network. Then you do not need to worry about using STUN/TURN. It's enough complicated as it is.

WP7 error: "The remote server returned an error: NotFound."

I have this code that it used to work, but at some specific time it stopped to work and returned the error "The remote server returned an error: NotFound."
WebClient deliciousWebClient = new WebClient();
deliciousWebClient.Credentials = Credentials;
deliciousWebClient.DownloadStringAsync(new Uri("https://api.del.icio.us/v1/tags/get"));
deliciousWebClient.DownloadStringCompleted += (s, ee) =>
{
if (ee.Error == null)
{
…
Any suggestion on this error?
In this code, the error is pointing to delicious endpoit, but the same error is happening with some other services...
The NotFound error is a classic 404 error, so it's possible that the API endpoint is down or that it changed on you.
I'd start by using Fiddler2 to make the requests manually. That'll help you figure out whether the issue is in your code somewhere or on the API side.
It's hard to get Fiddler working with the WP7 emulator, as you noted below. One trick I've used in the past when I got really desperate was to write a quick console app that used the same code that my Windows Phone app was executing. Then I was able to successfully intercept the traffic. It turned out that my request being properly formatted.