我想创建 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)