3

I have created simple chat application using SignalR, Visual studio 2013 (but application is in 2012), framework 4.5.

I use ASP.NET webforms only (Not MVC)

Its working when I run via visual studio. But when I configured it in IIS, it's giving the following error in page console -

GET http://localhost/chat/signalr/hubs 404 (Not Found) localhost/:30
Uncaught TypeError: Cannot read property 'client' of undefined localhost/chat/:112

'chat' is name of virtual directory.

Added foll. as well in web.config -

<system.webServer>
  <validation validateIntegratedModeConfiguration="false"/>
  <modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>

code from Global.asax.cs-

protected void Application_Start(object sender, EventArgs e)
    {
        // Register the default hubs route: ~/signalr/hubs
        RouteTable.Routes.MapHubs();
    }

Code from Index.Html -

<!--Reference the SignalR library. -->
<script src="Scripts/jquery.signalR-1.0.0.js"></script>

<!--Reference the autogenerated SignalR hub script. -->
<script src="signalr/hubs"></script>

I have tried this as well, but not successful -

<script src="<%= ResolveUrl("~/signalr/hubs") %>" type="text/javascript"></script>

NOTE - I am refering this http://www.codeproject.com/Articles/562023/Asp-Net-SignalR-Chat-Room Thanks in advance.

slfan
  • 8,950
  • 115
  • 65
  • 78
Abhi
  • 1,963
  • 7
  • 27
  • 33
  • I have tried every solution from following link - https://github.com/SignalR/SignalR/wiki/Faq – Abhi Jul 25 '13 at 18:30
  • Possible duplicate: http://stackoverflow.com/questions/17237037/signalr-fails-on-iis – slfan Jul 25 '13 at 18:39

3 Answers3

0

If you run it in Visual Studio you probably use IIS Express in version 8. SignalR uses web sockets which are not fully supported on IIS 7.x, therefore you have to use either Windows 8 or Server 2012. Of course you can use IIS Express 8 during development.

slfan
  • 8,950
  • 115
  • 65
  • 78
  • Are you saying I have to install IIS8? I am using IIS7 not 7.5 – Abhi Jul 25 '13 at 18:55
  • Correct, you either use Windows 8 or Server 2012. – slfan Jul 25 '13 at 19:02
  • I have installed IIS8 express on windows 7. Let me try with this. Is there any hope? – Abhi Jul 25 '13 at 19:16
  • @slfan : you are correct, VS 2013 is using IIS express to run. – Abhi Jul 25 '13 at 19:38
  • Wrong information, I am using SignalR with windows 2008 and IIS7 – Farukh Zahoor Sep 28 '16 at 15:35
  • Works fine on Windows 2008 R2 with IIS7 – Riz Sep 28 '16 at 15:42
  • @eFriend: It works, but it is not using web sockets. There is a fallback mechanism implemented. See here: https://blogs.msdn.microsoft.com/timlee/2013/03/21/hosting-a-signalr-application-on-windows-2008r2-and-iis-7-5/ – slfan Sep 28 '16 at 20:37
  • @FarukhZahoor: my information is correct. IIS7.x does not support websockets, SignalR will fallback on another mechanism. See here https://blogs.msdn.microsoft.com/timlee/2013/03/21/hosting-a-signalr-application-on-windows-2008r2-and-iis-7-5/ – slfan Sep 28 '16 at 20:39
0

I had the exactly problem, it was fixed after I installed the IIS 7.5 extensionless suport hotfix

Claudio Santos
  • 1,307
  • 13
  • 22
  • SignalR will work of course, but it will not use WebSockets because windows 7 does NOT support WebSockets. SignalR will use a fallback mechanism. See this blog post for further information https://blogs.msdn.microsoft.com/timlee/2013/03/21/hosting-a-signalr-application-on-windows-2008r2-and-iis-7-5/ – slfan Oct 12 '16 at 14:17
0

can you try to use websocket as transport layer

var connection = $.hubConnection('http://' + window.location.host); var proxy = connection.createHubProxy('chatHub');

connection.start({ transport: ['webSockets'] }).done(function () { });

Ahmed
  • 143
  • 1
  • 1
  • 6