简体   繁体   English

Angular 上的应用程序没有收到来自服务器的响应

[英]The application on Angular does not receive a response from the server

There is an application on Angular, the backend is an application on Java-Spring. Angular上有一个应用程序,后端是Java-Spring上的一个应用程序。 Both of them are running on a server in a shared network, on a Windows OC machine in VirtualBox (Linux).它们都在共享网络中的服务器上运行,在 VirtualBox (Linux) 中的 Windows OC 机器上运行。 The essence of the problem is that when you try to open a web application in a browser, it runs completely on one computer out of five with Windows OC and on one of one on Linux OC.问题的本质是,当您尝试在浏览器中打开 Web 应用程序时,它完全可以在五台装有 Windows OC 的计算机和一台使用 Linux OC 的计算机上运行。 The browser is everywhere Chrome, only in Linux Mozilla The application itself is launched, but it does not receive data from the backend at startup.浏览器无处不在 Chrome,仅在 Linux Mozilla 应用程序本身启动,但在启动时并没有从后端接收数据。 At the same time I get an error同时我得到一个错误

Failed to load resource:
http://10.151.78.6:5003/es-serv/api/v1/get-data/sh1 net::ERR_CONNECTION_RESET

Here is the controller method that receives requests, there is no call to it in the logs这是接收请求的控制器方法,日志中没有调用它

   @GetMapping("/get-data/" + RestApiConstants.VARIABLE_NAME)
    public ResponseEntity<ListResponse<DataDto>> getData(
       @PathVariable(RestApiConstants.PARAM_NAME_WORD) String name) {
        log.info("getData -> start");
        return converterDtoService.converterDataDto(name);
    }

Moreover, if you just try to open the link in the browser bar此外,如果您只是尝试在浏览器栏中打开链接

http://10.151.78.6:5003/es-serv/api/v1/get-data/sh1

Then I get the data every time, I have never noticed any failures.然后我每次都得到数据,我从来没有注意到任何失败。 Very similar to the problem with CORS, but then the browser gives a specific error to all requests.与 CORS 的问题非常相似,但是浏览器对所有请求都给出了特定的错误。 Yes, and cors is disabled in the Java application.是的,并且在 Java 应用程序中禁用了 cors。 And even then it is not clear why it still works on some browsers.即便如此,目前尚不清楚为什么它仍然适用于某些浏览器。 It doesn't look like a timeout problem either, because I get an error instantly, and when the server doesn't respond, some time passes and it's noticeable.它看起来也不是超时问题,因为我立即收到错误消息,并且当服务器没有响应时,经过一段时间并且很明显。 And another such moment, I added a forced data reading button to the application.另一个这样的时刻,我在应用程序中添加了一个强制数据读取按钮。 And after 20-30 attempts to read the data, the answer may still come to those computers that did not receive them.在尝试读取数据 20 到 30 次之后,答案可能仍然会出现在那些没有收到数据的计算机上。

If it was a problem with the network, then it is unclear why on the same computer from the same browser, the GET request typed in the browser line gets answers all the time, without a single pass.如果是网络问题,那么不清楚为什么在同一台计算机上使用同一浏览器,在浏览器行中键入的 GET 请求总是得到答案,而没有一次通过。

Tell me where to look to understand the reason?告诉我从哪里看明白原因?

对服务器的网络调用

The problem was solved by updating the browsers to the latest version.通过将浏览器更新到最新版本解决了该问题。 And before that, the browser version was not very old.而在此之前,浏览器版本还不是很旧。 I don't understand how this could affect the transmission of the GET request over the network?我不明白这会如何影响通过网络传输 GET 请求?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM