我有一个ASP.NET MVC 4应用程序(.NET 4.5)和SIgnalR与基于表单的身份验证(通过IIS/IIS Express托管)工作正常
一旦我将应用程序更改为Windows集成身份验证(<authentication mode="Windows"/>在"web.config"中)它就会停止工作.
jquery.signalR-2.2.2.min.js:9 WebSocket连接
ws://localhost:51030/signalr/connect?transport=webSockets&blhablahblah失败:WebSocket握手期间出错:意外响应代码:403
将[Authorize]属性添加到我的集线器后,错误将更改为
WebSocket连接
ws://localhost:51030/signalr/connect?transport=webSocketsblahblah失败:HTTP身份验证失败; 没有有效的凭证
该应用程序的其他部分工作正常,在服务器和工作等启用Windows身份验证等.
我该如何解决这个问题?
如果它由于某种原因无法解决(可能是Chrome不支持在websocket连接上使用windows auth或其他东西) - 为什么它不回归到非websocket协议?以及如何强制退回?
更新:我创建了一个github问题https://github.com/SignalR/SignalR/issues/3953.问题不在于我无法连接.问题是我无法处理错误以回退到另一个传输.也.fail()没有.error()被调用.Try-catch也没有帮助.
当我尝试在AngularJS应用和Spring Boot之间建立websocket通信时,出现错误:websocket握手期间出错-意外的响应代码:200。
这是我的JS代码:
function run(stateHandler, translationHandler, $websocket) {
stateHandler.initialize();
translationHandler.initialize();
var ws = $websocket.$new('ws://localhost:8080/socket'); // instance of ngWebsocket, handled by $websocket service
ws.$on('$open', function () {
console.log('Oh my gosh, websocket is really open! Fukken awesome!');
});
ws.$on('/topic/notification', function (data) {
console.log('The websocket server has sent the following data:');
console.log(data);
ws.$close();
});
ws.$on('$close', function () {
console.log('Noooooooooou, I want to have more fun with ngWebsocket, damn it!');
});
}
Run Code Online (Sandbox Code Playgroud)
这是我的Java代码:
WebsocketConfiguration.java
@Override
public void registerStompEndpoints(StompEndpointRegistry stompEndpointRegistry)
{
stompEndpointRegistry.addEndpoint("/socket")
.setAllowedOrigins("*") …Run Code Online (Sandbox Code Playgroud) 我已经在我的MVC5应用程序中实现了HTML5 Websocket。我已经使用Web API实现了此Web套接字。该代码在我的本地环境中运行良好。但这给了我测试环境以下的错误。
“与的WebSocket连接失败:HTTP身份验证失败;没有有效的凭据。”
我的服务器配置是带有IIS8的Windows Server 2012
请帮帮我。