Dear, along with saying hello I wanted to ask the following question to the problem that came up:
I happen to be doing some tests to work with SignalR, in which the results are successful when I do the tests on localhost, but when I publish to the production server, I get the following error:
Unknown host System.Net.Sockets.SocketException: Unknown host
The way I started was the following:
First download the signalR packets
Then create the Startup file:
using System;
using System.Threading.Tasks;
using Microsoft.Owin;
using Owin;
[assembly: OwinStartup(typeof(MvcMasterPrueba.Startup))]
namespace MvcMasterPrueba
{
public class Startup
{
public void Configuration(IAppBuilder app)
{
//ConfigureAuth(app);
app.MapSignalR();
}
}
}
hub file:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.AspNet.SignalR;
namespace MvcMasterPrueba
{
public class MyHub : Hub
{
public void Send(string name, string message)
{
Clients.All.broadcastMessage(name, message);
}
public void BroadcastMessageToAll(string nombreImpresora, String divHTML)
{
//Clients.All.newMessageReceived(message);
Clients.All.imprimeDiv(nombreImpresora, divHTML);
}
public void BroadcastMessageToPrinter(string nombreImpresora, String divHTML)
{
Clients.All.imprimeDiv(nombreImpresora, divHTML);
}
public void JoinAGroup(string group)
{
Groups.Add(Context.ConnectionId, group);
}
public void RemoveFromAGroup(string group)
{
Groups.Remove(Context.ConnectionId, group);
}
}
}
The strange thing that when publishing on the server, I get the error, I would greatly appreciate your help, if someone has any ideas, your opinion will be welcome. Thank you very much. Other important information, when trying to log me in, I get the error, that is to say in this part:
public ActionResult Acceder(string User, string Pass)
{
string estado = "0";
string ip = "";
string db = "";
string user = "";
string pass = "";
string password = "";
string sql = "SELECT ip,db,user,CONVERT(AES_DECRYPT('pass','1234444444') USING UTF8) AS pass,password " +
"FROM usuarios " +
"WHERE email='" + User + "' and password='" + Pass + "' limit 1";
conexion.conectar();
MySqlDataAdapter datos = new MySqlDataAdapter(sql, conexion.conlogin);
conexion.cerrar();
DataTable dt = new DataTable();
datos.Fill(dt);
foreach (DataRow row in dt.Rows)
{
ip = row[0].ToString();
db = row[1].ToString();
user = row[2].ToString();
pass = row[3].ToString();
password = row[4].ToString();
}
if (Pass == password)
{
Session["Session_User"] = User;
Session["ip"] = ip;
Session["db"] = db;
Session["user"] = user;
Session["pass"] = pass;
estado = "1";
Session["ss_nro_caja"] = obtieneNroCaja();
}
switch (estado)
{
case "0":
ViewData["Mensaje"] = "Usuario o Password invalido..!!";
return View("Login");
case "1":
FormsAuthentication.SetAuthCookie(User, false);
return RedirectToAction("Home", "Acceso");
default:
return View("Login");
}
}
It is assumed that when I go in this part, the error happens:
case "1":
FormsAuthentication.SetAuthCookie(User, false);
return RedirectToAction("Principal", "Acceso");