客户端注册Cannot execute request on any known server解决
在对eureka注册中心服务端添加安全验证后,新版本springcloud出现一个问题就是,在客户端注册到服务中心时报了一个错:Cannot execute request on any known server,重新仔细看了一下官方文档Securing The Eureka Server部分得以解决。
添加安全验证:https://www.cnblogs.com/zrk3/p/springcloud_securing_eurekaserver.html
一、官方文档

大意(英语不好,见谅):
只需通过Spring -boot-starter- security将Spring Security添加到服务路径中,就可以保护Eureka服务。默认情况下,当Spring Security位于类路径上时,它将要求在每次向应用程序发送请求时都发送一个有效的CSRF令牌。Eureka客户机通常不会拥有一个有效的跨站点请求伪造令牌(CSRF),您需要禁用/ Eureka /**端点的这个请求
2、添加配置文件
在eureka服务工程中添加配置文件:

package com.zrk.config; import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; /**
* @Description:
* @Author: zrk
* @Date: 2019/9/12
*/
@EnableWebSecurity
class WebSecurityConfig extends WebSecurityConfigurerAdapter { @Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().ignoringAntMatchers("/eureka/**");
super.configure(http);
}
}
重启eureka服务,重启客户端就发现已经可以注册成功。
客户端注册Cannot execute request on any known server解决的更多相关文章
- Eureka 客户端连接Eureka服务端时 报Cannot execute request on any known server 解决办法
报Cannot execute request on any known server 这个错,总的来说就是连接Eureka服务端地址不对. 因为配置eureka.client.serviceUrl. ...
- SpringCloud报错:com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
启动SpringCloudEureka 报错:com.netflix.discovery.shared.transport.TransportException: Cannot execute req ...
- Cannot execute request on any known server或DiscoveryClient_UNKNOWN/DESKTOP-MQ8D0C9:8761
报错信息如下: 2018-08-31 11:45:33.619 WARN 1068 --- [freshExecutor-0] c.n.d.s.t.d.RetryableEurekaHttpClien ...
- SpringCloud问题解决:spring-cloud-eureka启动出错Cannot execute request on any known server
场景: 在启动eureka server时,出现以下错误: com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectExce ...
- Cannot execute request on any known server
1.com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: c ...
- 如何消除 com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server
在application.properties中添加以下两句话: eureka.client.register-with-eureka=falseeureka.client.fetch-registr ...
- com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known server 报错问题
com.netflix.discovery.shared.transport.TransportException: Cannot execute request on any known serve ...
- 关于Eureka客户端连接服务端报错问题Cannot execute request on any known server
对于Eureka包这个错误问题:Cannot execute request on any known server,总的原因就是连接Eureka连接服务端的Url地址不对,Url地址不对很很多情况. ...
- springcloud报错Cannot execute request on any known server
启动springcloud服务中心,提示这个错误:Cannot execute request on any known server 网上一般说是修改application.properties配置 ...
随机推荐
- UDDI:百科
ylbtech-UDDI:百科 UDDI是一种用于描述.发现.集成Web Service的技术,它是Web Service协议栈的一个重要部分.通过UDDI,企业可以根据自己的需要动态查找并使用Web ...
- 通过一个name获取tbody下的其他name的值
<tbody id="add_enterGoods_table"> <tr> <td align="center">< ...
- 在react项目中启用mobx的配置方法
1.安装插件 npm install --save-dev babel-preset-mobx mobx mobx-react 2.package.json配置 "dependencies& ...
- 控制器Controller
1) org.springframework.web.servlet.mvc.ParameterizableViewController 如果请求是/hello.action的请求路径,则直接跳转到 ...
- Android之SharedPreference存储数据
*路径: /data/data/包名/shared_prefs/ * 以Xml文件存储数据 * 编写步骤 // 1. 获取sp SharedPreferences sp = this.getShare ...
- Python3+RobotFramewok RIDE环境搭建(一)
工欲善其事,必先利其器,RIDE目前可以比较稳定的支持python3了,这里简单介绍一下环境的部署,建议多看看读一读官方文档,对能力提升很有帮助,很简单的三步: (1)安装python3,不详细介绍了 ...
- flutter richText富文本
flutter中富文本使用 RichText( text: TextSpan( text: '登陆即同意', style: TextStyle(fontSize: 14, color: Colors. ...
- IDEA如何构建mybatis
任何一个软件都要和数据库关联,软件需要的数据都存储在数据库中. 对于经常使用的数据库相关的代码就出现了很多冗余的代码,持久层框架也随之出现. 目前使用比较流程的持久层框架有hibernate和myba ...
- redis基础学习---1
5.1.xshell传输文件命令快捷键:alt+p 2.当运行一个程序时,想退出按ctrl+c退出 3.给用户权限:chmod 777 redis.conf 另一种方式:chmod –x 4. 5.查 ...
- localhost解释
.localhost解释 localhost意思是只能从本地访问 比如说 kibana的配置文件里面写的是localhost,那就无法从浏览器访问到服务,必须写ip地址才可以从浏览器访问到