admin管理员组

文章数量:1627760

当配置文件配置的允许跨域串为空时报错提示如下:

InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Cors.Infrastructure.ICorsService' while attempting to activate 'Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddlewar

 

 

当allowedOrigins 为空,  

app.UseCors("Any") 之后就会报错。

 

解决方法,appsettings.json 里面配置的AllowedOrigins 允许跨域的地址不能为空,比如加上http://localhost:5001 。

 

 

本文标签: ServicetypeunableResolveMicrosoft