Click here to Skip to main content
15,886,632 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hello,

I have upgraded an ASP.NET project from SignalR 0.52 to SignalR 1.1.4 and it works fine when I run the application in Visual Studio 2010, but it doesn't work when I publish it to IIS 7.5. I have tried to publish to different IIS servers but still it is not working.

VB
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    RouteTable.Routes.MapConnection(Of MyEndPoint)("signalr", "/signalr")
End Sub

VB
Public Class Notifier

    Public Sub Notify(message As String)
        Dim context = GlobalHost.ConnectionManager.GetConnectionContext(Of MyEndPoint)()
        Try        
            context.Connection.Broadcast(message)
        Catch ex As Exception

        End Try
    End Sub

End Class


JavaScript
<script src="<%= Response.ApplyAppPathModifier("~/scripts/jquery-1.6.4.min.js") %>" type="text/javascript"></script>
<script src="<%= Response.ApplyAppPathModifier("~/Scripts/jquery.signalR-1.1.4.min.js") %>" type="text/javascript"></script>   
<script src="<%= Response.ApplyAppPathModifier("~/Scripts/json2.min.js") %>" type="text/javascript"></script>   

<script type="text/javascript">
$(function () {
	var connection = $.connection("/signalr");
	connection.received(function (data) {
        var text = "" + data + "<br/>";
       	$('#MyDiv').append(text); 
        });
        connection.start();
    });
</script>


I would like to note that I can access SignalR JavaScript Library in IIS by browsing to "/signalr/hubs/" but the first line in the generated JavaScript file displays the old version number "SignalR JavaScript Library v0.5.2". However, when I try to access "/signalr/hubs/" when running in VS 2010, I get the following error:

Server Error in '/' Application.

Protocol error: Unknown transport. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.InvalidOperationException: Protocol error: Unknown transport.

Source Error: 


 An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace: 



[InvalidOperationException: Protocol error: Unknown transport.]
   Microsoft.Owin.Host.SystemWeb.Infrastructure.<>c__DisplayClass1.<GetRethrowWithNoStackLossDelegate>b__0(Exception ex) +73
   Microsoft.Owin.Host.SystemWeb.Infrastructure.ErrorState.Rethrow() +40
   Microsoft.Owin.Host.SystemWeb.CallContextAsyncResult.End(IAsyncResult result) +155
   Microsoft.Owin.Host.SystemWeb.OwinHttpHandler.EndProcessRequest(IAsyncResult result) +34
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9514928
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155



Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18446


I appreciate your help :)
Posted

1 solution

Use hubs dude!
VB
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        RouteTable.Routes.MapHubs()
    End Sub


VB
<hubname("myhub")>
Public Class Notifier

    Public Sub Notify(message As String)
        Dim context = GlobalHost.ConnectionManager.GetHubContext(Of Notifier)()
        Try
            context.Clients.All.refresh(message)
        Catch ex As Exception

        End Try
    End Sub

End Class


XML
<script src="Scripts/jquery-1.6.4.min.js" type="text/javascript"></script>
<script src="Scripts/jquery.signalR-1.1.4.min.js" type="text/javascript"></script>
<script src="signalr/hubs" type="text/javascript"></script>


<script type="text/javascript">
$(function () {
    var context = $.connection.myHub;
        context.client.refresh = function (data) {
            alert(data);
        };
        $.connection.hub.start();
    });
</script>


Sincerely,
Computer Master in Bucketheadland
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900