【发布时间】:2014-06-04 09:52:28
【问题描述】:
我有一个运行 Web Api 和 c# 的 Azure 移动服务,并按照Enable CORS on Azure Mobile Serivce .NET Backend 中的建议启用了 CORS 但是我现在已经开始将 SignalR 添加到组合中。
SignalR 工作正常,但我看不到如何启用 CORS。
目前在我的测试应用配置中,我有以下内容:
//enable CORS for WebAPI
var cors = new EnableCorsAttribute("*", "*", "*");
httpconfig.EnableCors(cors);
//rather than use the static method new up SignalRExtensionConfig and pass the current config, hopefully allowing CORS...
var signalRConfig = new SignalRExtensionConfig();
signalRConfig.Initialize(httpconfig, ioc);
但是 CORS 不适用于 SignalR 集线器,它仅适用于 WebAPI :( 我感到沮丧:
请求中没有“Access-Control-Allow-Origin”标头 资源。因此不允许访问 Origin 'null'。
我检查了响应标头,可以确认没有发回任何内容。
谁能给点建议?
【问题讨论】:
标签: c# asp.net azure signalr azure-mobile-services