2
votes

I've got an ASP.NET Web Application with a simple SignalR setup and a hub. When i publish the files, it generates web/packages.config and the /bin/ dlls.

On client side, i can also easily access the hub on the IIS:

var hubConnection = new HubConnection("http://localhost:80");
IHubProxy proxy = hubConnection.CreateHubProxy("TestHub");

When i access http://localhost/signalr/hubs i can see the generated hub, but how exactly does it work? I can't find a /signalr/hubs directory in my IIS folder. When and how is it being generated?

1
I had the same question this morning. Thanks for the question.BetterLateThanNever

1 Answers

2
votes

The directory is not being generated at all, it never exists.

A big piece of ASP.NET, and web frameworks in general, is the router. Basically, you are familiar with static file handlers (that handle routes like "/myFolder/myFile.doc") and serve the file back to the browser.

You also need, however, a way to execute code. Since the primary way to execute requests against a web server is REST; web frameworks route certain URL-verb combinations to code handlers. This is how WebAPI and MVC both work. In the case of SignalR, it registers the "/signalr/hubs" route and returns the generated javascript file when that route is requested.