首页 > 编程知识 正文

vue登录页面代码,新javaweb实战项目

时间:2023-05-03 07:33:11 阅读:112864 作者:4405

另一方面,如果最初使用命令运行从abp new AoRuiDe.GasMonitoring或官方网站直接下载的项目,则默认情况下,如果没有域间配置,则在前后的单独页面上访问后端接口

二、添加跨域配置1、添加跨域配置:

MVC网站项目添加跨域配置: aoruide.gas monitoring.web/appsettings.cs

' app ' : ' selfurl ' : ' https://localhost :44349 ',' CORS origins ' : ' https://*.gas monitoring.com, 3358 localhost :9527 '//' CORS origins ' : ' http://* :9527,http://0.0.0.0:9527 )不支持此通配符表达式//当前端访问http://192.168.1.101:9527访问接口时呈现域间问题(,2,添加指定的域间支持),aoruide.gas monitoror

privateconststringdefaultcorspolicyname=' default '; publicoverridevoidconfigureservices (服务配置内容上下文) { varhostingenvironment=context.services.geth //...//添加域间支持:原始代码是context.services.add CORS (options={ options.add policy ) defaultcorspolicyname, builder={ builder.with origins (configuration (' app : CORS origins ).split )、)、stringsplitoptions.removemptyns . ToArray ).withabpexposedheaders.setisoriginallowedtoallowwildcardsubdomains ().AllowAnyHeader ).AllowAnyMethod ) ); ); } publicoverridevoidonapplicationinitializationcontextcontext varapp=context.getapplication initialization //必须放在以下两个前面才能有用。 否则,还是报告域间错误。 app.use CORS (defaultcorspolicyname ); app.UseIdentityServer (; app.UseAuthorization (; 6 ) 3、增加所有跨域支持:简单粗暴疗效好

privateconststringdefaultcorspolicyname=' default '; publicoverridevoidconfigureservices (服务配置内容上下文) { varhostingenvironment=context.services.geth //...//添加域间支持:原始代码是context.services.add CORS (options={ options.add policy ) defaultcorspolicyname, 添加builder={ builder.allowanyorigin (//此. WithAbpExposedHeaders ).setisoriginallowedtoallowwwwildcardsubdomains ) } 去除这个); ); } publicoverridevoidonapplicationinitializationcontextcontext varapp=context.getapplication initialization //必须放在以下两个前面才能有用。 否则,还是报告域间错误。 app.use CORS (defaultcorspolicyname ); app.UseIdentityServer (; app.UseAuthorization (; 6三、总结: app.use CORS (defaultcorspolicyname ); 这个句子的位置没有放在前面,所以打算报告死活问题,最后放弃,放在函数的开头,不可思议地给我草草了一下;

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。