9
votes

I have implemented HTML5 Websocket in my MVC5 Application. I have implemented this web socket using web API. This code is working fine in my local environment. But it is giving me below error in my test environment.

"WebSocket connection to '' failed: HTTP Authentication failed; no valid credentials available."

My server Configuration is Windows server 2012 with IIS8

Please Help me out.

3
Please help me to solve this issue. I am helpless - Virang Patel
Can be related to this, basically Chrome doesn't handle Win Authentication over WebSocket. You can switch to "longPolling" transport. - Davide Icardi
It's been a while but has google fixed this issue yet? - Shinya Koizumi

3 Answers

1
votes

We have a few customers who had this issue only on servers which were windows 2012. It seems related to websockets being present and on. Enabling Cross Domain fixed it for us on those servers.

  // Turn cross domain on 
    var config = new HubConfiguration { EnableCrossDomain = true };

    // This will map out to http://localhost:50001/signalr by default
    app.MapHubs(config);
0
votes

My reason is that filter intercepts in server

@Override
public void doFilter(ServletRequest request, ServletResponse response,
                     FilterChain chain) throws IOException, ServletException {
    HttpServletRequest req = (HttpServletRequest) request;
    HttpServletResponse rep = (HttpServletResponse) response;
    handleRequest(req);

    // swagger 不过滤
    String ur = req.getRequestURI();
    if (req.getRequestURI().contains("swagger")
            || req.getRequestURI().contains("swagger")
            || req.getRequestURI().contains("v2/api-docs")
            || req.getRequestURI().contains("websocket")
            || req.getRequestURI().startsWith("/images/favicon-")
            || req.getRequestURI().startsWith("/configuration/")
            || req.getRequestURI().startsWith("/v2/editapi/") ) {

        chain.doFilter(request, response);
    }
0
votes

I don't know if it can help you, but worth try!

There is and old issue here at SO that explain about authentication with Web Socket (JS generic websocket).

Please, check this issue: HTTP headers in Websockets client API