User-1399352090 posted
Hello,
I have created web api windows service self hosting based on https://github.com/danesparza/OWIN-WebAPI-Service
for self host i'm using http://localhost:9000
namespace WindowsApiServices
{
public partial class TestApi : ServiceBase
{
public string baseAddress = "http://localhost:9000/";
private IDisposable _server = null;
public TestApi()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
_server = WebApp.Start<Startup>(url: baseAddress);
}
protected override void OnStop()
{
if (_server != null)
{
_server.Dispose();
}
}
}
}
[assembly: OwinStartup(typeof(SaawtApiServices.Startup))]
namespace SaawtApiServices
{
public partial class Startup
{
/
public void Configuration(IAppBuilder app)
{
HttpConfiguration config = new HttpConfiguration();
ConfigureAuth(app);
WebApiConfig.Register(config);
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
app.UseWebApi(config);
app.MapSignalR();
}
}
}
namespace Utilites
{
public class ProgressHub: Hub
{
public void Send(string name, string message)
{
Clients.All.addMessage(name, message);
}
}
}
then i have created web application using above self hosting webapi and configured on same pc's IIS "localhost:100"
reffered : https://docs.microsoft.com/en-us/aspnet/signalr/overview/deployment/tutorial-signalr-self-host
<script src="~/Scripts/jquery.signalR-2.2.2.min.js"></script>
<script src="http://localhost:9000/signalr/hubs"></script>
$.connection.hub.url = "http://localhost:9000/signalr";
console.log($.connection.hub)
var hubProxy = $.connection.progressHub;
console.log(hubProxy);
when i debug using console .long i got to know that proxies are empty {}
and logging is flase.
i tried with http://localhost:100/signalr/hubs and $.connection.hub.url = "http://localhost:100/signalr"
but hubProxy .client.addMessage = function (name, message) { } not fired
what i did mistake ?please help.
Appricate for quick and best reponse