Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Error: InnerException: System.InvalidOperationException
- HResult=-2146233079
- Message=There was an error invoking Hub method 'Test.DetermineLength'.
- public class Program
- {
- static void Main(string[] args)
- {
- string url = @"http://localhost:8080/";
- using (WebApp.Start<StartUp>(url))
- {
- Console.WriteLine(string.Format("Server running at {0}", url));
- Console.ReadLine();
- }
- }
- public class StartUp
- {
- public void Configuration(IAppBuilder app)
- {
- app.UseCors(CorsOptions.AllowAll);
- app.MapSignalR();
- }
- }
- [HubName("Test")]
- public class TestHub : Hub
- {
- [Authorize]
- public void DetermineLength(string message)
- {
- Console.WriteLine(message);
- string newMessage = string.Format(@"{0} has a length of: {1}", message, message.Length);
- Clients.All.ReceiveLength(newMessage);
- }
- }
- }
- public class Program
- {
- static void Main(string[] args)
- {
- IHubProxy _hub;
- string url = @"http://localhost:8080/";
- var connection = new HubConnection(url);
- _hub = connection.CreateHubProxy("Test");
- connection.Start().Wait();
- string line = null;
- while ((line = System.Console.ReadLine()) != null)
- {
- _hub.Invoke("DetermineLength", line).Wait();
- _hub.On("ReceiveLength", x => Console.WriteLine(x));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement