Pregunta

I'm trying to create a server and a asp.net client (2 projects in one solution..). In the server in the class where the hub is defined i get an error ... I use visual studio 2013.

this is the startup:

using System;
using System.Threading.Tasks;
using Microsoft.Owin;
using Owin;

[assembly: OwinStartup(typeof(TestServer.Startup))]

namespace TestServer
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            // Any connection or hub wire up and configuration should go here
            app.MapSignalR();
        }
    }
}

the hub:

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR;
using Microsoft.AspNet.SignalR.Hubs;


namespace TestServer
{
    [HubName("ServerHub")]
    class ServerHub : Hub
    {
        public void Send(string message)
        {
            Clients.All.AddMessage(message);
        }
    }
}

it marks Clients.All.AddMessage(message) as an error : "One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?" I can't understand what reference is missing.

¿Fue útil?

Solución

You need to include the Microsoft.CSharp library.

It's easy to do, under the Add Reference dialog go to the Assemblies -> Framework tab. You'll see Microsoft.CSharp listed, add it.

Hope this helps!

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top