我在线程中用ef写sql数据库的exe文件放到服务器就失败呢?

我在线程中用ef写sql数据库的exe文件放到服务器就失败呢?
提示:未将对象引用设置到对象的实例
代码:
private bool SaveData(float[] dispVal, ClientDto client)
{
//保存, 判断通道,没有则添加
ExtHost h;
BLL.ExtHostBLL host = new ExtHostBLL();

        h = host.GetHostByHostcode(client.HostId);

        int channelIndex = 1;
        string channelId = "";
        foreach (decimal val in dispVal)
        {

            if (!host.ExistChannel("通道" + channelIndex, h.Id, out channelId))
            {
                channelId = Common.Result.GetNewId();
                host.AddChannel(channelId, "通道" + channelIndex, client.HostId);

            }
            host.AddChannelData(Common.Result.GetNewId(), channelId, val);
            channelIndex++;

        }
        return true;

    }

和服务器没有关系,你的代码有问题,具体要调试才知道
天知道你的bll的代码怎么写的。

h = host.GetHostByHostcode(client.HostId);获得h为null吗