notlkk
notlkk

Reputation: 1231

Using SignalR in a Website Project

I'm trying a very simple demo of SignalR but getting the infamous "undefined" error on the following line in my javascript:

var myHub = $.connection.myHub;

MyHub.cs is as follows:

public class MyHub : Hub
{
    ...
}

Most of the examples I've seen so far are MVC or web application projects. With those, MyHub.cs would be placed in the App_Code folder. However, our project is a website project and we can't change it to a web application.

What can I do to make it work?

Upvotes: 4

Views: 966

Answers (1)

notlkk
notlkk

Reputation: 1231

It turned out that I missed the following in web.config:

<modules runAllManagedModulesForAllRequests="true">

And yes, you can absolutely use SignalR in a website project.

Upvotes: 5

Related Questions