在包含网站中使用 FormsAuthentication 时,WCF 4 引发异常
我的 ASP.Net MVC 2 项目的文件夹中有一个 WCF 4 REST WebService。还可以使用“crossDomainScriptAccessEnabled”绑定选项在服务上启用 JSONP。 该网站和服务都很棒。但是,我刚刚注意到,如果您登录到网站(意味着您有 cookie),然后通过在浏览器中点击 URL 来“测试”API 方法,我会收到此错误:
跨域 不支持 JavaScript 回调 在经过身份验证的服务中。
我在网站内使用表单身份验证。在我的本地计算机上运行和部署时都会发生这种情况。
在 Asp.net 论坛上阅读让我想到需要设置一个配置设置以确保身份验证设置为匿名。有没有人找到办法解决这个问题?有没有办法告诉 WCF 忽略 FormAuthentication cookie?
I have a WCF 4 REST WebService within a folder in my ASP.Net MVC 2 project. JSONP is also enabled on the service using the 'crossDomainScriptAccessEnabled' binding option.
The site and service work great. But, I just noticed that if you are signed in to the website (meaning you have a cookie) and then you 'test' an API method by hitting the URL in the browser I get this error:
Cross domain
javascript callback is not supported
in authenticated services.
I'm using Forms Authentication within the site. This happens both when running on my local machine and deployed.
Reading on the Asp.net forums made me think there is an config setting that I need to set to make sure authentication is set to anonymous. Has anyone found a way to get around this? Is there a way to tell WCF to ignore the FormAuthentication cookie?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试在
内的 web.config 中设置
看看这是否在本地有效。Try setting
<authentication mode="None"/>
in web.config inside<system.web>
to see if this works locally.