在IIS中托管SignalR [英] Host SignalR in IIS
问题描述
我只是想知道,过去几天一直在寻找我,是否有可能在IIS中托管SignalR集线器?那有可能吗?我找到了一个称为自我托管"的解决方案,但是它是借助控制台应用程序来帮助的.我想在我的IIS中托管SignalR集线器吗?有人可以为我提供一个例子吗?
I'm just wondering and it is hunting me for these past few days is it possible to Host a SignalR Hub in IIS? is that event possible? i found a solution called "self hosting" but it is with the help of a console application. i want to host the SignalR Hub in my IIS is that possible? can someone provide me an example regarding this?
我打算发布自托管代码,我认为我可能会帮忙
im going to post the code for the self Hosting i thought i might help
class Program
{
static void Main(string[] args)
{
// This will *ONLY* bind to localhost, if you want to bind to all addresses
// use http://*:8080 to bind to all addresses.
// See http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx
// for more information.
string url = "http://localhost:8080";
using (WebApp.Start(url))
{
Console.WriteLine("Server running on {0}", url);
Console.ReadLine();
}
}
}
class Startup
{
public void Configuration(IAppBuilder app)
{
app.UseCors(CorsOptions.AllowAll);
app.MapSignalR();
}
}
public class MyHub : Hub
{
public void Send(string name, string message)
{
Clients.All.addMessage(name, message);
}
}
推荐答案
在IIS中托管SignalR就像使用SignalR Hub创建网站,然后将其发布到IIS中的网站一样简单.
Hosting SignalR in IIS is as simple as creating a website with a SignalR Hub, and then publishing it to a website within your IIS.
然后,SignalR集线器将位于 http://www.yourdomain.com/
The SignalR Hub will then be located at http://www.yourdomain.com/
如果您在此处按照本教程进行操作,则会找到所需的 http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr
If you follow this tutorial here, you will find out what you need http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr
这篇关于在IIS中托管SignalR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!