I've set up this ASP VS 2013 project in which I'm using signalR.
This works smoothly. Code of the html file:
<script src="../Scripts/jquery.signalR-2.1.1.js"></script>
<script src="../signalr/hubs"></script>
<script src="SignalR.StockTicker.js"></script>
When debugging this, it is hosted on
http://localhost:50408/SignalR.Sample/StockTicker.html
Now I'm trying to do the same in a Non VS project.
So I've changed the script source :
<script src="imported/jquery.signalR-2.1.1.js"></script>
<script src="http://localhost:50408/signalr/hubs"></script>
<script src="imported/SignalR.StockTicker.js"></script>
But this doesn't work when running. Even after specifying the url in the js code
$.connection.hub.url = 'http://localhost:50408/signalr/hubs';
$.connection.hub.start()
or even without /signalr/hubs
$.connection.hub.url = 'http://localhost:50408/signalr/';
But All I get is a blank screen.
What could be wrong here?
Cheers!
Well you need a web server for processing user requests! SignalR establishes a long-running connection between an user's browser and a web server.
More info
When running the web application in Visual Studio, VS actually starts a web server which hosts your signalR hub. If you're going to deploy your web application, you need a web server. Example.
Related
In my hybrid application which developed using C#, WPF, CEF, and VueJs.
On RDP, CefSharp loaded event is trigged and Vue JS components are loading fine.
But from Vue JS application the communication to C# is failing.
CEF Version : CefSharp.WPF 79.1.360
There are no issues when we run the same on the local computer. This issue observed only when we take a remote desktop.
Steps to reproduce the issue.
Application is running in a remote machine and we are accessing through RDP.
On the launch of the application, everything works fine.
After I disconnect the RDP and login after 1 hour, it tries to re-loads the page. UI looks fine and javascript able to call the web APIs.
Issue occurs in communication between Javascript to .net.
I tried to call the C# .net method from JS. I am getting error as undefined.
From JS when C# .net object is undefined, I have tried JavascriptObjectRepository_Resolve on IsLoaded event.
It also does not work.
Please let me know anyone encounters this issue and any workaround suggestions?
I have a simple setup based on the example code of signalR.
Client is a .net core console app.
Server is a.net core web app with signalR published to local IIS website.
Everything works fine in general.
if i stop/start the server using the IIS manager, 'reconnecting', 'reconnected' events do fire.
However if i re-publish the server ( asp.net app), via the visual studio- publish menu.. events are not fired on the client..and its not able to reconnect either. not even 'closed ' event. just sits there doing nothing.
i need to explicitly need to 'restart' the IIS website to get things going again.
Any ideas anyone what could be going on under the hood?
I have created a simple chat application following the Getting Started With SignalR URL. When I run and test the program it is working wonderfully fine.
I tried to create a simple client out of this application with a simple HTML and required SignalR.JS package installed as instructed in the second part of Self Hosting SignalR the article where a html and set of JS files try to access the chat application hosted in IIS (one developed following the Getting Started URL.
I am getting the signalr/hubs 404 Not Found error when firebug is used to trace and is not working. Can someone please help me understand what change we need to do to get the chat server working from the JavaScript (and any other) client application.
My chat server is hosted in my IIS as srserver (virtual directory) and the client again is hosted in IIS as srclient (virtual directory) . It is not Cross domain but still not able to get this working.
I had similar problem , that i was missing in the auto generated hubs js (visual studio generates it automatically but when in production environment i had to place it there)
you can generate it using the following command, and than place in the production environment :
signalr ghp /path:[path to the .dll that contains your Hub class]
follow the full instrutinos here
I am successfully running SignalR application on my LocalHost using VS 2010 (4.0 frameWork) And SignalR version 1.1.3 as per following link:
http://www.asp.net/signalr/overview/signalr-1x/getting-started/tutorial-getting-started-with-signalr
But When i deploy this Web Application on my IIS Server:
It throws Javascript Error as
'client' is null or not an object
What should I check..?
TIA
This happens due to not correctly including the dynamic signalr hubs file. In the sample you're reference they are doing:
<script src="/signalr/hubs"></script>
Which is perfectly fine locally. However, if you are to deploy that application to IIS you'd need to ensure that your app is running at the ROOT if you're server.
I'm guessing when you deploy to IIS you're hosting it off of an endpoint like localhost/mysignalrapp/YOUR_STUFF. If that's the case the /signalr/hubs inclusion will not work.
Assuming your html file is at the root if your project try changing the include to:
<script src="signalr/hubs"></script>
This will enable your app to correctly find the signalr endpoint. If you happen to have your HTML file in folders not at the root, adjust the path accordingly.
Do you have a script reference to both the client library and ~/signalR/hubs?
I have an ASP.NET application running on two almost identical Virtual Windows Server 2003. The first one is my develop and test server. I have installed the .NET WebExtensions for Framework 2.0 there and the application runs well. Now I tried to publish the same application on a second server (lets call him the production server) and also installed the .NET WebExtensions there and compiling and database access runs as well as the complete APS.NET application. Except for calling the static PageMethods through JavaScript AJAX calls. I have used the developer tools of the IE8 to debug into the JavaScript and found that it works identically. Still, all calls of the WebMethods return and internal server error (error code 500) saying "Unknown web method index.php".
Does anybody know what might be wrong with the production server or which configuration need to be changed?
The main difference between the two servers is that the production server uses .NET .../Framework64/v2.0.50727/aspnet_isapi.dll, while the test server uses .../Framework/v2.0.50727/aspnet_isapi.dll.
Some more details:
All PageMethods are static, return a string and have the WebMethod-Attribute.
On both servers the JavaScript creates an XmlHttpRequest object using the resolved URL "http://myDomain/myPage.aspx/myWebMethod" and the "Content-Type"-Header "application/json charset="utf-8" and the bodies contain the correct JSON definition of the parameters for the PageMethods.
Of course all ASPX-pages that use the AJAX PageMethods do have an ASPX-ScriptManager hving the EnablePageMethods-attribute set to "True".
I have solved my problem. There was an ISAPI_ewrite on the production server configured to work globally on all websites. After I have changed that setup to website individual ISAPI_Rewrite for those websites that need to use that rewrite, the AJAX XmlHttpRequests work.