ASP.NET SignalR

http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/upgrading-signalr-1x-projects-to-20


ASP.NET SignalR is a new library for ASP.NET developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time.

What can it be used for?

Pushing data from the server to the client (not just browser clients) has always been a tough problem. SignalR makes it dead easy and handles all the heavy lifting for you.

=========

Please see http://go.microsoft.com/fwlink/?LinkId=272764 for more information on using SignalR.


Upgrading from 1.x to 


2.0
-------------------------

Please see http://go.microsoft.com/fwlink/?LinkId=320578 for more information on how to 
upgrade your SignalR 1.x 
application to 2.0.


=============Need to publish and go ahead to use new vs.net 




Mapping the Hubs connection
----------------------------
To enable SignalR in your application, create a class called 


Startup with the following:






using Microsoft.Owin;
using Owin;
using MyWebApplication;


namespace MyWebApplication
{
    public class Startup
    {
        


public void Configuration(IAppBuilder app)
        {
            app.MapSignalR();
        }
    }



Getting Started
---------------
See http://www.asp.net/signalr/overview/getting-started for more information on how to get started.


Why 


does ~/signalr/hubs return 404 or Why do I get a JavaScript error: 'myhub is undefined'?
--------------------------------------------------------------------------------------------
This issue is generally 


due to a missing or invalid script reference to the auto-generated Hub JavaScript proxy at '~/signalr/hubs'.
Please 


make sure that the Hub route is registered before any other routes in your application.
 
In ASP.NET MVC 4 you can do 


the following:
 
      <script src="~/signalr/hubs"></script>
 
If you're writing an ASP.NET MVC 3 application, make sure 


that you are using Url.Content for your script references:
 
    <script src="@Url.Content("~/signalr/hubs")"></script>
 
If you're writing a regular ASP.NET application use ResolveClientUrl for your script references or register them via 


the ScriptManager 
using a app root relative path (starting with a '~/'):
 
    <script src='<%: ResolveClientUrl


("~/signalr/hubs") %>'></script>
 
If the above still doesn't work, you may have an issue with routing and extensionless 


URLs. To fix this, ensure you have the latest 
patches installed for IIS and ASP.NET. 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值