SignalR sticky sessions with F5 and Citrix - signalr

we have a web application (angular) that needs to interact with a winform application. we do that via SignalR.
the browser and winform are deployed on a citrix server.
There is a webfarm of IIS servers and on those we have the webapi services and also the signalR Hubs.
all network activity goes via F5 loadbalancer.
the problem we are facing - is how to make sure the web applicaion running on chrome, and the windows forms application connect both to the same SignalR Hub Server.
we cannot use stickey sessions based on Origin IP as all users are using the citrix infrastructure, so all have the same origin IP.
using a cookie - i am not sure that the cookie is shared between the browser and the winform app. and anyways cookie in a websocket scenario isnt working (right ?)
is the only solution using a backplane ? (not using dotnet core at the moment)

Override or Change source Signalr
Private Task ProcessNegotiationRequest-->
string connectionId = !string.IsNullOrEmpty(context.Request.QueryString["ConnId"]) ? context.Request.QueryString["ConnId"]: connectionId = Guid.NewGuid().ToString("d");
And send conId in querystring

Related

Azure Mobile Services Authentication, ..Identity.IsAuthenticated always false

We are developing an azure mobile services application and are having some difficulty with authentication.
The X-ZUMO-AUTH and X-ZUMO-APPLICATION HTTP headers are being sent from the client to the server correctly, yet on the server HttpContext.Current.User.Identity.IsAuthenticated remains false.
The server is a MVC/Web API ASP.NET application.
Is there some sort of configuration we could be missing to get this working?
Undoubtedly you are missing something. I hope you mean Azure Mobile Apps (and not Azure Mobile Services).
You need to integrate the Azure Mobile Apps SDK on the server side, and turn on and configure Azure App Service Authentication & Authorization. In addition, if it's a straight MVC app, you will need to add the OWin initializer to your Startup.cs file.
Check out Chapter 6 of http://aka.ms/zumobook

How to make Secure service to service calls between ASP.Net website and agent

I have a ASP.Net WebAPI service that is used by my AngularJS front end and I am making use of Owin and bearer token.
Now there is a need that we need to install an agent on the few of the client machines (developed in .Net core mostly) that is able to connect to our application and make similar calls. I can create a separate controller for this need, but want to host it in the same website.
How can I create a secure connection between this agent and the ASP.Net server hosted on Azure?
Currently I am looking at generating a Token during the agent installation based on the client MAC address and giving it with each call, but I am checking if there are any better way to address this need.
Any help in this direction is welcome.
Regards
Kiran
It seems that you’d like to enable only valid “agents” that installed on the client machines to communicate with your server, if that is the case, Azure AD provides Native Application to Web API authentication scenario (a native application that runs on a phone, tablet, or PC needs to authenticate a user to get resources from a web API that is secured by Azure AD), you could refer to it.

Consume java web service from .NET Web Service and/or asp.net web application

I'm trying to consume a Java Web Service from third party, so i dont have any control over it. I have a pfx file which is password protected, and i installed it in my development box.
This is the code i'm using:
var proxy = new MyServiceReference.WsaaServerBeanService();
var result = proxy.login("test");
I'm getting System.Net.Sockets.SocketError.TimedOut exception when invoking the login web method. The first thing that come to my mind is an authentication issue. Apart from installing the pfx, do i need to send some other info to the web server to authenticate?
System.Net.Sockets.SocketError.TimedOut
Does not indicate an authentication issue, it indicates that you either are not able to contact the remote web service endpoint, or you are and the service is taking too long to respond. Make sure you can actually hit the endpoint from your machine via telnet, a web browser etc...
Authentication failures will usually return immediately.

Asp.Net : Best way to broadcast data from WCF service to Asp.Net client

I need to create a high-frequency realtime web application and I would like to know the best way for doing it!
A WCF Service hosted in a Windows Service needs to refresh browser clients (ASP.NET application) each seconds with fresh data (often with IE8).
I've think about 2 solutions :
1. WCF Callback from WCF Service to Asp.Net Application server side and SignalR from ASP.NET Application server side to ASP.NET Application client side.
SignalR from WCF service to Asp.NET Application client side but is it possible??? If yes, how because I just found tutorials with communication between Asp.net server side and cient side and never with signalR as server hosted in a WCF.
Documentation I found is :
http://blog.maartenballiauw.be/post/2011/12/06/Using-SignalR-to-broadcast-a-slide-deck.aspx
http://www.asp.net/signalr/overview/getting-started/tutorial-server-broadcast-with-aspnet-signalr
http://www.asp.net/signalr/overview/getting-started/tutorial-high-frequency-realtime-with-signalr#serverloop
Thks
I think this post can help: SignalR as WCF web socket service :
...
You can self-host the SignalR server:
Taken from (https://github.com/SignalR/SignalR/wiki/QuickStart-Hubs):

Authentication from ASP.NET web app to ASP.NET web service to SQL Server

I've got an ASP.NET (.NET 4.0) application that uses Windows Forms Authentication. This authenticates against Active Directory and works just fine.
This web app calls an ASP.NET Web Service(.NET 4.0) on the same server. Both the app and the service are running on IIS 6.
The web service calls a SQL Server 2005 database in the same domain using "Integrated Security=SSPI" as part of the connection string.
I want the web service and the database connection to use the credentials of the logged in user of the web app.
I've tried dozens of combination of settings from dozens of web sites, but nothing has worked. I'm on my second day and haven't gotten anywhere.
Is this even possible?
In my latest attempt, I added this code in the web app before calling the web service:
svc.Credentials = System.Net.CredentialCache.DefaultCredentials;
But inside the service, User.Identity.Name returns the value of the user who started the web server.
What you're trying to do is called "delegation". It means that the end-user is authenticated with the web server, and then the web server tries to use those credentials to gain access to the SQL Server. But the SQL Sever does not trust the web server, it only trusts the domain controller. So the request fails.
Besides not working, delegation has another disadvantage. Because each user would use different credentials, SQL connections would no longer be pooled. Each credential would have its own pool. That would be a major resource hog even at low user counts.
For more information, check out this MSDN article.
TL;DR: Give up on delegation and move to SQL auth.

Resources