Click here to Skip to main content
15,885,919 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Suggestion[Repost] popup issue for showModalDialog Pin
Richard Deeming14-Oct-14 4:02
mveRichard Deeming14-Oct-14 4:02 
QuestionPassing GUID to a function Pin
Huma Ansari13-Oct-14 20:18
Huma Ansari13-Oct-14 20:18 
AnswerRe: Passing GUID to a function Pin
Mycroft Holmes13-Oct-14 20:44
professionalMycroft Holmes13-Oct-14 20:44 
AnswerRe: Passing GUID to a function Pin
Richard Deeming14-Oct-14 1:45
mveRichard Deeming14-Oct-14 1:45 
QuestionMy code is not working while using with updatepanel.The ddl selected item it coming blank whiule printing before using update panel it was coming. Pin
ank065713-Oct-14 19:35
ank065713-Oct-14 19:35 
QuestionIs there a way to capture all the page records in jqgrid when exporting to excel Pin
parkway13-Oct-14 9:15
parkway13-Oct-14 9:15 
AnswerRe: Is there a way to capture all the page records in jqgrid when exporting to excel Pin
devvvy13-Oct-14 9:32
devvvy13-Oct-14 9:32 
QuestionRegarding Self hosting SignalR Application in Win Service Pin
Tridip Bhattacharjee13-Oct-14 5:20
professionalTridip Bhattacharjee13-Oct-14 5:20 
i was just reading a article on Self hosting SignalR Application in Win Service from this url http://damienbod.wordpress.com/2014/06/03/signalr-self-hosting-template-for-a-windows-service/

code was not very clear to me.so here i am pointing out those line of code point wise. apologized for bit big question.

C#
namespace SignalREngineServiceWindowsService
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            // Remove this if you want to test as a console application and add an arg
            ServiceBase.Run(new SignalREngineServiceWindowsService());

            if (args != null)
            {
                try
                {
                    Startup.StartServer();
                    Console.ReadKey();
                }
                finally
                {
                    Startup.StopServer();
                }
            }
        }
    }
}

[assembly: OwinStartup(typeof(Startup))]

namespace SignalREngine
{
    public class Startup
    {
        static CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource();

        // Your startup logic
        public static void StartServer()
        {
            var cancellationTokenSource = new CancellationTokenSource();
            Task.Factory.StartNew(RunSignalRServer, TaskCreationOptions.LongRunning
                                  , cancellationTokenSource.Token); 
        }

        private static void RunSignalRServer(object task)
        {
            string url = "http://localhost:8089";
            WebApp.Start(url);
        }

        public static void StopServer()
        {
            _cancellationTokenSource.Cancel();
        }

        // This code configures Web API. The Startup class is specified as a type
        // parameter in the WebApp.Start method.
        public void Configuration(IAppBuilder app)
        {
            app.Map("/signalr", map =>
            {
                map.UseCors(CorsOptions.AllowAll);
                var hubConfiguration = new HubConfiguration
                {
                };

                hubConfiguration.EnableDetailedErrors = true;
                map.RunSignalR(hubConfiguration);
            });
        }
    }
}


1) just see this line...what is the meaning

ServiceBase.Run(new SignalREngineServiceWindowsService());

how we can instantiate namespace because this is the namespace name SignalREngineServiceWindowsService i think we should specify the class name...what u say!

2)

public static void StartServer()
{
var cancellationTokenSource = new CancellationTokenSource();
Task.Factory.StartNew(RunSignalRServer, TaskCreationOptions.LongRunning
, cancellationTokenSource.Token);
}

here we are calling a method with TPL but what is the meaning of this option or param TaskCreationOptions.LongRunning and cancellationTokenSource.Token ?

3)

private static void RunSignalRServer(object task)
{
string url = "http://localhost:8089";
WebApp.Start(url);
}

see this url string url = "http://localhost:8089"; here can't we specify machine IP where self host apps will run? is it mandatory to write like localhost ?

4)

public static void StopServer()
{
_cancellationTokenSource.Cancel();
}

what will happen when this line will be invoked _cancellationTokenSource.Cancel(); ?

how it can stop the signalr hub ?

5)

public void Configuration(IAppBuilder app)
{
app.Map("/signalr", map =>
{
map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration
{
};

hubConfiguration.EnableDetailedErrors = true;
map.RunSignalR(hubConfiguration);
});
}

who will call Configuration() function because i found no routine in code from where Configuration() will be called ?

6) RunSignalR() ? is any built-in function ?

7) what is the difference between this line map.RunSignalR(hubConfiguration); and map.MapSignalR(); ?

8) i found another approach to point out the startup class....here it is

C#
static void Main(string[] args)
{
            string url = "http://localhost:6118";
            using (WebApp.Start<Startup>(url))
            {
                Console.WriteLine("The Server URL is: {0}", url);
                Console.ReadLine();
            }
}


class Startup
{
public void Configuration(IAppBuilder MyApp)
{
MyApp.MapSignalR();
}
}

what is Startup class & what it does or what its role in self hosting ?

i just go through a article and after reading it lots of confusion occur. so i just need answer for my question. so it will be great if some one answer point wise.

here i am including few more url which also talk about signalr selfhost but their coding approach is bit different but understandable.

here is those url
C#
http://www.c-sharpcorner.com/UploadFile/4b0136/introduction-of-Asp-Net-signalr-self-hosting/

https://code.msdn.microsoft.com/windowsapps/SignalR-self-hosted-in-6ff7e6c3

http://www.dotnetcurry.com/showarticle.aspx?ID=918

tbhattacharjee

QuestionHow to embed a video in my c# based dot net website which should be compatible in all browsers especially chrome. Pin
Member 1107698013-Oct-14 1:15
Member 1107698013-Oct-14 1:15 
Questionasp.net web service error "Microsoft.Web.Services3.Security.SecurityFault: Header http://schemas.xmlsoap.org/ws/2004/08/addressing:Action for ultimate recipient is required but not present in the message." Pin
rafay ansar12-Oct-14 10:32
rafay ansar12-Oct-14 10:32 
AnswerRe: asp.net web service error "Microsoft.Web.Services3.Security.SecurityFault: Header http://schemas.xmlsoap.org/ws/2004/08/addressing:Action for ultimate recipient is required but not present in the message." Pin
jkirkerx12-Oct-14 11:48
professionaljkirkerx12-Oct-14 11:48 
QuestionHow to use JScript to get mouse position inside image? Pin
Troublesome Tommy10-Oct-14 10:19
Troublesome Tommy10-Oct-14 10:19 
AnswerRe: How to use JScript to get mouse position inside image? Pin
Troublesome Tommy11-Oct-14 6:57
Troublesome Tommy11-Oct-14 6:57 
QuestionSignalR - Jquery response - 304 error Pin
miss78610-Oct-14 4:28
miss78610-Oct-14 4:28 
QuestionHow to sms through asp.net website on mobile Pin
Harishankar Maurya9-Oct-14 19:21
Harishankar Maurya9-Oct-14 19:21 
AnswerRe: How to sms through asp.net website on mobile Pin
Mahinuddin11-Oct-14 1:53
Mahinuddin11-Oct-14 1:53 
QuestionGetting error while running Pin
Member 111411249-Oct-14 3:50
Member 111411249-Oct-14 3:50 
AnswerRe: Getting error while running Pin
Richard Deeming9-Oct-14 6:59
mveRichard Deeming9-Oct-14 6:59 
QuestionHow to maintain scroll position in chrome in Asp .Net Pin
Member 98439578-Oct-14 18:52
Member 98439578-Oct-14 18:52 
AnswerRe: How to maintain scroll position in chrome in Asp .Net Pin
Dominic Burford10-Oct-14 0:39
professionalDominic Burford10-Oct-14 0:39 
GeneralRe: How to maintain scroll position in chrome in Asp .Net Pin
Member 984395710-Oct-14 0:44
Member 984395710-Oct-14 0:44 
Questionregex replace with double quote Pin
jkirkerx8-Oct-14 13:30
professionaljkirkerx8-Oct-14 13:30 
AnswerRe: regex replace with double quote Pin
Richard Deeming9-Oct-14 1:47
mveRichard Deeming9-Oct-14 1:47 
GeneralRe: regex replace with double quote [EDIT] fixed my regex Pin
jkirkerx9-Oct-14 8:05
professionaljkirkerx9-Oct-14 8:05 
QuestionGreybox popup not show properly after postback Pin
Member 98439577-Oct-14 19:35
Member 98439577-Oct-14 19:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.