小编Han*_*tha的帖子

将 WCF REST 服务托管为 Windows 服务

我想创建 REST WCF 服务并将其安装为 Windows 服务。我已经创建了 REST WCF 服务并运行了它,它对于 xml 和 json 都工作正常。以下是代码文件。IrestWCFServiceLibrary.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace RestWCFServiceLibrary
{
    // NOTE: If you change the class name "Service1" here, you must also update the             reference to "Service1" in App.config.
    public class RestWCFServiceLibrary : IRestWCFServiceLibrary
    {
        public string XMLData(string id)
        {
            return "Id:" + id;
        }
        public string JSONData(string id)
        {
            return "Id:" + id;
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

RestWCFServiceLibrary.cs

using System;
using …
Run Code Online (Sandbox Code Playgroud)

.net c# rest wcf windows-services

4
推荐指数
1
解决办法
8694
查看次数

标签 统计

.net ×1

c# ×1

rest ×1

wcf ×1

windows-services ×1