Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Network access is disabled - What are my options?



  • I've not found anything useful about this error. Some old threads seem to treat it as something random or just pure bad luck. Others may point to an old bug which was apparently fixed long time ago.

    The program I'm creating runs on my machine, but it's intended to be installed on a Windows Server 2019 PC. There, this problem appears.

    My code basically looks like this. This is a synchronous sample. The URL "www.showmyip.com" could be anything:

        QString         sContents;
        QNetworkRequest nrqRequest;
        QNetworkReply   *nrpReply;
        nrqRequest.setUrl(QUrl("https://www.showmyip.com/"));
        // namManager is defined in the constructor as "new QNetworkAccessManager(this)"
        nrpReply=namManager->get(nrqRequest);
        while(!nrpReply->isFinished())
            QApplication::processEvents(QEventLoop::ProcessEventsFlag::ExcludeUserInputEvents);
        if(nrpReply->error()==QNetworkReply::NetworkError::NoError)
            if(200==nrpReply->attribute(QNetworkRequest::Attribute::HttpStatusCodeAttribute).toInt()) {
                sContents=nrpReply->readAll();
                // ...
            }
            else
                QMessageBox::critical(this,"Response Error","Invalid response code");
        else
            QMessageBox::critical(this,"Connection Error",nrpReply->errorString());
        nrpReply->~QNetworkReply();
    

    Well, when this code runs in the server, it shows the "Connection Error" message box, with "Network access is disabled".

    I created an installer for this program, using windeployqt.

    I don't know what more to do to track the source of this problem.

    Any ideas?



  • @Alvein said in Network access is disabled - What are my options?:

    "Network access is disabled".

    Have you check that you actually has access (i.e. ping, traceroute, telnet, etc. may help) to the destination URL/IP from the PC you're deploying?



  • @Pablo-J-Rogina Well, the real URL gives the same error in the program. That's two failing URLs.

    I'll try and confirm anyway. It's my client the one who has to do those tests since I don't have access to that server.

    I couldn't grasp the fact that there's actually a connection problem in the server. I.e., how does it work with the rest of stuff it's supposed to do daily...

    I'll ask my client to try those tests and be back here.

    Thanks for your advice.



  • @Pablo-J-Rogina Hello.

    Ping, tracert and telnet tests were successful.

    Now pay attention to this.

    My program has two ways of accessing the network. One, is like the sample code I posted before. And the other is by using QWebEngineView to actually browse some pages.

    • Currently, QWebEngineView browses with no problems, but QNetworkReply gets the "Network access is disabled" error.

    • On my development machine, If I disable the network by hand, I get the "Network access is disabled" error, AND QWebEngineView shows "No internet".

    • I checked, and there's no firewall-related problem involved. In fact, I tried to block the program on my machine and the error I get is distinct: "Permission denied". And that also blocks QWebEngineView.

    • I used a non-secure HTTP address to verify it's not something about SSL or port 443. Same problem.

    • Tried another sample app (simple HTTP get using sockets) that I made years ago, coded in Visual Basic. Worked flawlessly in the server.

    • Installed a virtual machine with Windows Server 2019 in my machine. Everything works with no problems there.

    • I've built the "HTTP Example" which comes with Qt (https://code.qt.io/cgit/qt/qtbase.git/tree/examples/network/http?h=5.14), and guess what...it fails with "Network access is disabled" as well.

    Remember: this server does have Internet access, it can ping, tracert, telnet, browse to the sample locations. It can even connect to those locations through a 3rd-party app coded in something different to Qt.

    Why is QNetworkReply failing on that computer? How can I figure out a reason? It's a mystery.
    Somebody help.



  • Hi, just guessing my perhaps something's screwed up with Qt's bearer management
    Perhaps try creating a QNetworkSession and check its configuration...



  • @hskoglund Long read ahead. I don't know any of those concepts.

    I'll give it a look and be back. Thanks. :)



  • @Alvein Yeah, don't know so much either, but I've seen that topic "bearer management" coming up before.
    Also there's a plugin at C:\Qt..\plugins\bearer\qgenericbearer.dll. I've written/deployed several networking programs but never had to copy that .dll, but you might need to.



  • @hskoglund I have a client who's not exactly amused because of the amount of tests I've tried so far to locate the issue. He's already suggesting me to use anything but Qt.

    I wish I could do all those tests myself...

    I'll take your suggestions into consideration, if I have a chance.



  • @Alvein One more suggestion: if there's some antivirus software installed on that server, try disabling it.

    (As I said, I've deployed Qt network programs without problems (for example for automatic posting of appointment reminders SMS) to WIndows server 2003, 2012 and 2016. But not to Server 2019, but it shouldn't matter)



  • Hi,
    I get "Network access is disabled" when I have a static IP set on my computers (no DHCP) when I try to communicate using https and Qt 5.14
    It works fine with Qt 5.11 in any case.
    It works fine with Qt 5.14 if I use a DHCP-assigned IP-Addresses on my computers.

    All computers runs 64bit Windows 10.



  • @Christian-Andersson Same here too, doesnt work in 5.14. Did anyone find a fix?



  • Because of time constraints, my solution to this was using the cURL library.
    I find the network support in Qt a little untrustworthy.

    TBH, the target website had its own quirks. I had to use HTTP/1.0 for some calls. Go figure...


Log in to reply