Asked by:
How to create a physical file for the SignalR generated proxy

Question
-
User-1634604574 posted
can anyone tell me about step 3 and 4 it not clear
As an alternative to the dynamically generated proxy, you can create a physical file that has the proxy code and reference that file. You might want to do that for control over caching or bundling behavior, or to get IntelliSense when you are coding calls to server methods.To create a proxy file, perform the following steps:
1-Install the Microsoft.AspNet.SignalR.Utils NuGet package.
2-Open a command prompt and browse to the tools folder that contains the SignalR.exe file. The tools folder is at the following location:
[your solution folder]\packages\Microsoft.AspNet.SignalR.Utils.2.1.0\tools
3-Enter the following command:
signalr ghp /path:[path to the .dll that contains your Hub class]
The path to your .dll is typically the bin folder in your project folder.
This command creates a file named server.js in the same folder as signalr.exe.
4-Put the server.js file in an appropriate folder in your project, rename it as appropriate for your application, and add a reference to it in place of the "signalr/hubs" reference.
Tuesday, June 25, 2019 9:52 AM
All replies
-
User-474980206 posted
what part don't you understand.
step 3 is to run the CommandLine utility included with the nuget package to produce the javascript proxy file.
step 4 is copy the js file to your script folder of choice and change the html page to use this script rather than the dynamic script generated at runtime by the Signal/R middleware.
Tuesday, June 25, 2019 7:38 PM -
User61956409 posted
I installed Microsoft.AspNet.SignalR.Utils.2.4.1 and the tools SignalR.exe is at:
[solution folder]\packages\Microsoft.AspNet.SignalR.Utils.2.4.1\tools\net40
To generate a physical file for the SignalR generated proxy, run following command first,
cd [solution folder]\packages\Microsoft.AspNet.SignalR.Utils.2.4.1\tools\net40
then enter and run this command:
signalr ghp /path:[solution folder]\SignalRChat\bin
The file server.js will be created in the same folder as signalr.exe
With Regards,Fei Han
Wednesday, June 26, 2019 2:03 AM -
User-1634604574 posted
i have this error
SignalR Utility Version: 2.4.1.0
Creating temp directory C:\Users\CentralFoods\AppData\Local\Temp\1e05547a-d202-4f9b-ba36-385c56d50a32
Error: Failed to load assembly 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' referenced by the server. If your application uses a newer version of this assembly, this error is likely due to a missing or inaccurate binding redirect. If your server application has a 'Web.config' or '[AppName].exe.config' file with binding redirects in it, provide the path to that file with the '/configFile' parameter. If you have already provided a '/configFile' parameter, make sure the config file it points to has a binding redirect for 'Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' within it. See https://aka.ms/about-binding-redirects for more information on binding redirects.Wednesday, June 26, 2019 9:50 AM -
User61956409 posted
Please check if your web.config has binding redirect for 'Newtonsoft.Json', like below.
<dependentAssembly> <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" /> </dependentAssembly>
With Regards,
Fei Han
Thursday, June 27, 2019 5:16 AM -
User-1634604574 posted
also i have this error
Error: Failed to load assembly 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' referenced by the server. If your application uses a newer version of this assembly, this error is likely due to a missing or inaccurate binding redirect. If your server application has a 'Web.config' or '[AppName].exe.config' file with binding redirects in it, provide the path to that file with the '/configFile' parameter. If you have already provided a '/configFile' parameter, make sure the config file it points to has a binding redirect for 'Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' within it. See https://aka.ms/about-binding-redirects for more information on binding redirects.
i installed newtonsoft.json version 6.0.8
and SignalR Utility Version: 2.4.1.0
Thursday, June 27, 2019 6:22 AM -
User61956409 posted
You can try to uninstall and reinstall Newtonsoft.Json version 6.0.0 manually, and this SO thread discussed similar issue, you can refer to it.
With Regards,
Fei Han
Monday, July 1, 2019 2:22 AM