小编dru*_*bit的帖子

在Windows服务中安装和运行WCF服务

我不是C#或.NET专家.但是,我必须使用它......

我正在运行InstallUtil.exe MyService.exe以安装基本上运行WCF服务的Windows服务.我已经定义了WFC接口并实现了它.以下是界面.

[ServiceContract(Namespace = "http://WCFService", Name = "WCFService")]
public interface IWCFService
{
    [OperationContract]
    User Login(string userName, string password);

    [OperationContract]
    List<Project> GetProjects(Guid userGuid);

    [OperationContract]
    List<Stylesheet> GetStylesheets(Guid projectGuid);

}
Run Code Online (Sandbox Code Playgroud)

我还定义了一个Windows服务,如下所示:

public partial class Service: ServiceBase
{
    public FlatWsdlServiceHost m_fwsh = null; // extends ServiceHost

    public DesignerService()
    {
        InitializeComponent();
    }

    protected override void OnStart(string[] args)
    {

        this.EventLog.WriteEntry("OnStart Successfull", EventLogEntryType.Information);

        if (m_fwsh != null)
        {
            m_fwsh.Close();
        }

        // Create a ServiceHost for the EventWebService type and 
        // provide the base address. …
Run Code Online (Sandbox Code Playgroud)

.net c# wcf windows-services

2
推荐指数
1
解决办法
6872
查看次数

标签 统计

.net ×1

c# ×1

wcf ×1

windows-services ×1