当我尝试启动在C#中创建的windows服务时,收到以下错误:
到目前为止我的代码:
private ServiceHost host = null;
public RightAccessHost()
{
InitializeComponent();
}
protected override void OnStart(string[] args)
{
host = new ServiceHost(typeof(RightAccessWcf));
host.Open();
}
protected override void OnStop()
{
if (host != null)
host.Close();
host = null;
}
更新#1
我通过授予账号网络服务的权限解决了上面的问题,但现在我有另一个问题:
更新#2
无法启动
服务。System.InvalidOperationException:服务'RightAccessManagementWcf.RightAccessWcf‘没有应用程序(非基础结构)终结点。这可能是因为找不到应用程序的配置文件,也可能是因为在配置文件中找不到与服务名称匹配的服务元素,或者是因为在服务元素中没有定义终结点。在System.ServiceModel.Description.DispatcherBuilder.EnsureThereAreNonMexEndpoints(ServiceDescription描述)在System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription描述,在超时)在System.ServiceModel.ServiceHostBase.InitializeRuntime()在System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan超时)在System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan超时)在RightAccessHosting.RightAccessHost.OnStart(String[]参数)在C:\ ServiceHostBase ...
https://stackoverflow.com/questions/4267051
复制相似问题