locked
Does SignalR have to start in Startup.cs? RRS feed

  • Question

  • User-1849651236 posted

    Hello,

    I'm developing an C#, Asp.net, MVC 5, .Net 4.5 Web Application class library in Visual Studio 2017 Community.  It is a plugin for a web application.  It does not have a Startup.cs file.

    I want to use SignalR 2.0 to call methods that run on the client.  I used this tutorial to get started and it shows how to code the Startup.cs.

    My project does not have a Startup.cs file.

    So, can I put that coding in the post ActionResult method that gets called as a result of a button click?  The ActionResult method is in my controller.

    That is my first step in starting to use SignalR.  I'm sure I will have more questions as I proceed to set up my project to use SignalR.

    Any help that anyone can provide would be gratefully appreciated.

    Thanks,
    Tony

    Monday, October 16, 2017 5:24 PM

Answers

  • User1771544211 posted

    Hi tgirgenti,

    tgirgenti

    So, can I put that coding in the post ActionResult method that gets called as a result of a button click?  The ActionResult method is in my controller.

    As far as I know, the startup class is mandatory in each ASP.NET 5 application. You can put it in files other than the starup.cs file. But you have to define at least one starup class inside your project.  So then you can put the code that required for running the Signalr inside that startup class.

    The following link will help you understand the starup class inside ASP.NET project, please take it as reference.

    https://www.codeproject.com/Tips/1069787/Understanding-Startup-cs-file-in-ASP-NET

    Best Regards,

    Jean

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 17, 2017 5:37 AM

All replies

  • User1771544211 posted

    Hi tgirgenti,

    tgirgenti

    So, can I put that coding in the post ActionResult method that gets called as a result of a button click?  The ActionResult method is in my controller.

    As far as I know, the startup class is mandatory in each ASP.NET 5 application. You can put it in files other than the starup.cs file. But you have to define at least one starup class inside your project.  So then you can put the code that required for running the Signalr inside that startup class.

    The following link will help you understand the starup class inside ASP.NET project, please take it as reference.

    https://www.codeproject.com/Tips/1069787/Understanding-Startup-cs-file-in-ASP-NET

    Best Regards,

    Jean

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, October 17, 2017 5:37 AM
  • User-1849651236 posted

    Jean,

    Thanks for your help.

    Very good information.

    Thanks,
    Tony

    Thursday, October 19, 2017 7:19 PM