致电WebService-没有访问控制允许来源 [英] Call WebService - no Access-Control-Allow-Origin

查看:124
本文介绍了致电WebService-没有访问控制允许来源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在IIS上,我已部署了自定义Web服务,该服务调用数据库服务器并以XML返回数据并在下拉列表中填充数据.
从IIS workfine检查webserice.

但是当我使用AJAX HTTP请求从SharePoint页面调用网络服务时,出现以下错误.

在AJAX请求中,我已经添加了以下内容:
类型:"POST",contentType:"text/xml",dataType:"xml",crossDomain:true,xhrFields:{withCredentials:true,},标头:{"Access-Control-Allow-Credentials":" ; true"},


无法加载https://myportal.mydomain.com/servicecor/cor.asmx?op=Get_KPI_Code: 
所请求的资源上没有"Access-Control-Allow-Origin"标头.因此,不允许访问来源"https://myportal.mydomain.com".
响应的HTTP状态码为500.

请指导可能存在的问题以及解决方法.
谢谢


iffi

Hi,

On IIS i have deployed custom webservice which call database server and return data in XML and populate data in dropdown.
Check webserice from IIS workfine.

but when i call webservice from SharePoint page using AJAX HTTP request getting following error. 

in AJAX request i have already added following:
type:'POST',contentType:"text/xml",dataType:"xml",crossDomain:true,xhrFields:{withCredentials:true,},headers:{"Access-Control-Allow-Credentials":"true"},


Failed to load https://myportal.mydomain.com/servicecor/cor.asmx?op=Get_KPI_Code: 
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://myportal.mydomain.com' is therefore not allowed access. 
The response had HTTP status code 500.

pls guide what could be an issue and how to fix it.
Thx


iffi

推荐答案

您的Web服务是否处理  "Access-Control-Allow-Origin"标头?

does your web service handle the 'Access-Control-Allow-Origin' header?


这篇关于致电WebService-没有访问控制允许来源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆