[英]Signalr with Aspx Asp.Net
I am working on a project which is a asp.net application by using c# 4.5. 我正在使用c#4.5开发一个asp.net应用程序的项目。 I am trying to implement signalr into my project.
我正在尝试将Signalr实施到我的项目中。 So far when i use it in html, i can send the request and can get the response into JavaScript from server side.
到目前为止,当我在html中使用它时,我可以发送请求并可以将响应从服务器端转换为JavaScript。 But my application structure is based on master pages and web forms with master page.
但是我的应用程序结构基于母版页和带有母版页的Web表单。 I define the paths of the required scripts correctly (which i have already tested by using in html and working well).
我正确定义了所需脚本的路径(我已经通过在html中使用它进行了测试并且运行良好)。 When i run the app, scripts are running and an error occurs such as
当我运行应用程序时,脚本正在运行,并且发生错误,例如
0x800a138f - JavaScript runtime error: Unable to get property 'serverHub' of undefined or null reference
0x800a138f-JavaScript运行时错误:无法获取未定义或空引用的属性“ serverHub”
serverHub is the serverHub是
var serverSide = $.connection.serverHub;
var serverSide = $ .connection.serverHub;
creating a proxy but this error averts me to keep going on. 创建代理,但此错误使我无法继续操作。 So far what i have seen from the examples for the signalr, all of them is done in a html page.
到目前为止,我从信号器的示例中看到的所有内容都在html页面中完成。 So here is my question;
所以这是我的问题; SignalR is being used just only in html?
SignalR仅在html中使用? if it is no then am i able to use it in aspx pages like i explained above, how can i do this?
如果不是的话,那么我可以在上述的aspx页面中使用它,该怎么办?
Thank you so much for your helps in advance and will be waiting for your any supportive ideas. 非常感谢您的提前帮助,我们将等待您的支持。
You should take a look on this article : 您应该看一下这篇文章:
http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr
When you try to use signalR in your project don't forget to map signalr on startup, for example : 当您尝试在项目中使用signalR时,请不要忘记在启动时映射signalr,例如:
public partial class Startup
{
public void Configuration(IAppBuilder app)
{
app.MapSignalR();
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.